Attaches a file to an existing list item.
POST /_api/web/lists/GetByTitle('{listName}')/items('{spId}')/AttachmentFiles/add(FileName='{fileName}')
Uploads a file to a document library folder, overwriting any existing
file with the same name. payload may be a Buffer or a Readable.
POST /_api/web/GetFolderByServerRelativeUrl('{serverRelativeUrl}/{folder}')/Files/add(url='{fileName}',overwrite=true)
Creates a list item.
POST /_api/web/lists/GetByTitle('{listName}')/items
Sends several REST requests in one round trip.
POST /_api/$batch
Requires SharePoint 2016 or later. Each sub-request gets its own
BatchResponse; a failing sub-request does not fail the batch, so
check ok on each. Consecutive writes are grouped into one changeset
(atomic on the server); reads are sent as individual parts.
const res = await connection.batch({
requests: [
{ method: 'GET', path: `_api/web/lists/GetByTitle('Tasks')/items?$top=5` },
{ method: 'POST', path: `_api/web/lists/GetByTitle('Tasks')/items`, body: { __metadata: { type }, Title: 'A' } },
{ method: 'MERGE', path: `_api/web/lists/GetByTitle('Tasks')/items(7)`, body: { __metadata: { type }, Title: 'B' } },
],
})
Checks whether a folder exists.
GET /_api/web/GetFolderByServerRelativeUrl('{serverRelativeUrl}/{folder}')/Exists
Creates a folder. The parent folder must already exist.
POST /_api/web/folders
Deletes a file from a document library.
POST /_api/web/GetFileByServerRelativeUrl('{serverRelativeUrl}/{folder}/{fileName}') with X-HTTP-Method: DELETE
Deletes a list item.
POST /_api/web/lists/GetByTitle('{listName}')/items('{spId}') with X-HTTP-Method: DELETE
Like SiteConnection.getFolderContents but follows nextLink
until every file is collected (or maxPages is reached).
data is every file; if any page fails, the whole call is that
Failure (no partial results).
Like SiteConnection.getListContents but follows nextLink until
every item is collected (or maxPages is reached).
data is every item; if any page fails, the whole call is that
Failure (no partial results).
Performs the NTLM handshake against the site and returns the resulting
Authorization header value (NTLM Type 3 message).
This is a low-level diagnostic: NTLM authenticates the TCP connection,
not the request, so the value cannot be reused for later requests. Use it
to verify credentials, not to obtain a requestDigest — that comes from
SiteConnection.getFormDigestValue.
Downloads a file.
GET /_api/web/GetFolderByServerRelativeUrl('{serverRelativeUrl}/{folder}')/Files('{fileName}')/$value
Downloads a file as a stream, without buffering it in memory.
GET /_api/web/GetFolderByServerRelativeUrl('{serverRelativeUrl}/{folder}')/Files('{fileName}')/$value
Lists the files directly inside a folder (subfolders are not included).
GET /_api/web/GetFolderByServerRelativeUrl('{serverRelativeUrl}/{folder}')/Files?{params}
Obtains a request digest, required as requestDigest by every write
action.
POST /_api/contextinfo
Queries one page of list items.
GET /_api/web/lists/GetByTitle('{listName}')/items?{params}
data is the OData value array, typed as T[] (unchecked).
nextLink is set when SharePoint has more items than it returned;
pass it to SiteConnection.getNextPage, or use
SiteConnection.getAllListContents.
Reads a single list item by ID.
GET /_api/web/lists/GetByTitle('{listName}')/items('{spId}')
Reads the list's entity type name, needed in __metadata.type when
creating or updating items.
GET /_api/web/lists/GetByTitle('{listName}')?$select=ListItemEntityTypeFullName
Fetches the page a previous result's nextLink points at.
GET {nextLink}
The link must be on the connection's own host; anything else is rejected
with a Failure so credentials are never sent elsewhere.
Streams folder contents one page at a time. Yields each PageResult; ends after the last page or the first failure.
Streams list items one page at a time. Yields each PageResult; ends after the last page or the first failure.
Runs a CAML query against a list.
POST /_api/web/lists/GetByTitle('{listName}')/GetItems?{params}
Use this instead of $filter when a list exceeds the 5,000-item view
threshold: CAML <Where> clauses on indexed columns are evaluated by
SQL Server and are not subject to it. Page with <RowLimit> in the view
and pagingInfo built from the last item's Id.
Partially updates a list item (OData MERGE with If-Match: *, so the
last write wins).
POST /_api/web/lists/GetByTitle('{listName}')/items('{spId}') with X-HTTP-Method: MERGE
All actions bound to one site. Create with
createSiteConnection.Write actions need a request digest; the connection obtains, caches and refreshes one automatically. Pass
requestDigestyourself only if you want to manage it (see SiteConnection.getFormDigestValue).