saveLibraryAttachments
3p-core / saveLibraryAttachments
Function: saveLibraryAttachments()
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
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
saveLibraryAttachments(formContext, listItemId, libraryName, lookupFieldName, sectionFieldName?, section?)