Skip to main content

pushFile

@spartanfx/react v1.2.2


@spartanfx/react / spfx / pushFile

Function: pushFile()

function pushFile(
sp,
context,
listName,
itemId,
file,
fieldName): Promise<string>;

Uploads an image to SharePoint using the UploadImage REST API.

Parameters​

sp​

SPFI

The SPFI instance for list retrieval.

context​

any

The SPFx web part context.

listName​

string

The name of the target SharePoint list.

itemId​

number

The ID of the list item to update.

file​

File

The image file to upload.

fieldName​

string

The internal field name for the image column.

Returns​

Promise<string>

A stringified object representing the new image field value.

Example​

Minimal usage

pushFile(sp, context, listName, itemId, file, fieldName)