Skip to main content

saveListFormAttachment

@spartanfx/react v1.2.2


@spartanfx/react / spfx / saveListFormAttachment

Function: saveListFormAttachment()

function saveListFormAttachment(listFormContext, listItemId): Promise<void>;

Saves the current state of file attachments to SharePoint.

This function:

  • Uploads new attachments added by the user
  • Deletes attachments marked for removal

It should be invoked after the list item has been saved to ensure a valid itemId is available.

Parameters​

listFormContext​

IListFormContext

The current list form context containing attachment state.

listItemId​

number

The ID of the list item to which attachments should be saved.

Returns​

Promise<void>

void

Examples​

const savedItem = await ctx.saveListItem(data);
await saveListFormAttachment(ctx, savedItem.Id);

Minimal usage

saveListFormAttachment(listFormContext, listItemId)

Full usage

saveListFormAttachment(
// listFormContext: description,
listFormContext,
// listItemId: description,
listItemId
)