Skip to main content
Version: 2.1.4

saveLibraryAttachments

3p-core v2.1.4


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

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

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