Skip to main content

saveLibraryAttachments

@spartanfx/react v1.2.2


@spartanfx/react / spfx / saveLibraryAttachments

Function: saveLibraryAttachments()

function saveLibraryAttachments(
formContext,
listItemId,
libraryName,
lookupFieldName,
sectionFieldName?,
section?): Promise<any[]>;

Saves the state of attachments to the associated document library.

  • New files are uploaded.
  • Deleted files are moved to the recycle bin.
  • Existing files are not updated.

Parameters​

formContext​

IListFormContext

List form context providing access to PnP and state.

listItemId​

number

ID of the parent list item to link attachments to.

libraryName​

string

Name of the target SharePoint document library.

lookupFieldName​

string

Internal name of the field linking back to list item.

sectionFieldName?​

string

Optional internal name of a section field.

section?​

string

Optional section value to filter or assign files to.

Returns​

Promise<any[]>

A Promise resolving when all operations are complete.

Example​

Minimal usage

saveLibraryAttachments(formContext, listItemId, libraryName, lookupFieldName, sectionFieldName?, section?)