Skip to content

SharePoint File Operations

Upload, create, rename, move, recycle, and share SharePoint files. Each operation requires its own flag in allowedSharePointOperations. Connections with read-only scopes return READONLY_SCOPE on every write.

POST/api/access/sharepoint/files/uploadBearer Token

Upload File

Uploads a new file. Binary travels in the raw request body, metadata in the query string.

Required Operation

Requires upload_file. Server enforces a 100 MB body ceiling.
POST /api/access/sharepoint/files/upload
?fileName=Plan.docx
&folderId=sharepoint:drive:b!…:item:01ROOT
&mimeType=application/vnd.openxmlformats-officedocument.wordprocessingml.document
&description=Q2%20draft
Content-Type: <fileMimeType>
<binary body>

Query Parameters

ParameterRequiredNotes
fileNameyesName to assign in SharePoint
folderIdyesTarget folder/library — prefixed file ID
mimeTypenoIf omitted, server falls back to Graph's auto-detect
descriptionnoOptional description metadata

Response 200 OK

{ "success": true, "fileId": "sharepoint:drive:b!…:item:01NEW" }

Response 403 Forbidden

{
"success": false,
"errorMessage": "Connection has read-only scopes; cannot upload.",
"errorCode": "READ_ONLY"
}

Possible errorCode values: READ_ONLY, OPERATION_NOT_ALLOWED, NO_PROVIDER, BLOCKED. READ_ONLY fires when the connection is delegated Files.Read.All-only or a Sites.Selected grant with role: read.

POST/api/access/sharepoint/foldersBearer Token

Create Folder

Creates a folder under a library or another folder.

Required Operation

Requires create_folder. Body shape: CreateDriveFolderRequest.
{
"name": "Sprint 42",
"parentFolderId": "sharepoint:drive:b!…:item:01ROOT",
"description": "Optional"
}
PATCH/api/access/sharepoint/files/{fileId}/renameBearer Token

Rename File

Renames a file or folder.

Required Operation

Requires rename_file. Body shape: RenameDriveFileRequest.
{ "newName": "Plan v2.docx" }
PATCH/api/access/sharepoint/files/{fileId}/moveBearer Token

Move File

Moves a file/folder to a new parent within the same drive/document library.

Required Operation

Requires move_file. Body shape: MoveDriveFileRequest.

Same drive only

Cross-drive moves return 400 with errorCode = "INVALID_ID". Source and destination must live in the same document library.
{ "destinationFolderId": "sharepoint:drive:b!…:item:01DEST" }
DELETE/api/access/sharepoint/files/{fileId}Bearer Token

Delete File

Soft-deletes a file/folder. The item lands in the SharePoint recycle bin.

Required Operation

Requires delete_file.

Soft delete

Items remain restorable for the tenant's retention window (default 93 days). PortEden does not expose recycle-bin restore.

Response 204 No Content

(empty body)
POST/api/access/sharepoint/files/{fileId}/shareBearer Token

Share File

Adds a sharing permission to a file.

Required Operation

Requires share_file. Body shape: ShareDriveFileRequest.
{
"type": "user",
"role": "reader",
"emailAddress": "colleague@contoso.com",
"sendNotification": true,
"message": "Take a look"
}

Body Fields

FieldRequiredAllowed values
typeyesuser, group, domain, anyone
roleyesreader, writer (commenter is mapped to reader for SharePoint)
emailAddressfor user, grouprecipient identity
domainfor domaintenant or external domain
sendNotificationnodefault true
messagenoincluded in the email Microsoft sends