Codeunit "SharePoint Graph Client"
Provides functionality for interacting with SharePoint through Microsoft Graph API.
Remarks
Each procedure documents the required Microsoft Graph application permission (Sites.Read.All, Sites.ReadWrite.All, or Sites.Manage.All). Alternatively, the Sites.Selected permission can be used to restrict access to specific sites. With Sites.Selected, the actual access level is determined by the role (read, write, fullcontrol) granted per-site via the /sites/{siteId}/permissions endpoint.
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
Initialize
Initializes SharePoint Graph client.
procedure Initialize(NewSharePointUrl: Text; GraphAuthorization: Interface "Graph Authorization")
Parameters
| Name | Type | Description |
|---|---|---|
| NewSharePointUrl | Text |
SharePoint site URL. |
| GraphAuthorization | Interface System.Integration.Graph.Authorization."Graph Authorization" |
The Graph API authorization to use. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
Initialize
Initializes SharePoint Graph client with a specific API version.
procedure Initialize(NewSharePointUrl: Text; ApiVersion: Enum "Graph API Version"; GraphAuthorization: Interface "Graph Authorization")
Parameters
| Name | Type | Description |
|---|---|---|
| NewSharePointUrl | Text |
SharePoint site URL. |
| ApiVersion | Enum System.Integration.Graph."Graph API Version" |
The Graph API version to use. |
| GraphAuthorization | Interface System.Integration.Graph.Authorization."Graph Authorization" |
The Graph API authorization to use. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
Initialize
Initializes SharePoint Graph client with a custom base URL.
procedure Initialize(NewSharePointUrl: Text; BaseUrl: Text; GraphAuthorization: Interface "Graph Authorization")
Parameters
| Name | Type | Description |
|---|---|---|
| NewSharePointUrl | Text |
SharePoint site URL. |
| BaseUrl | Text |
The custom base URL for Graph API. |
| GraphAuthorization | Interface System.Integration.Graph.Authorization."Graph Authorization" |
The Graph API authorization to use. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
Initialize
Initializes SharePoint Graph client with an HTTP client handler.
procedure Initialize(NewSharePointUrl: Text; ApiVersion: Enum "Graph API Version"; GraphAuthorization: Interface "Graph Authorization"; HttpClientHandler: Interface "Http Client Handler")
Parameters
| Name | Type | Description |
|---|---|---|
| NewSharePointUrl | Text |
SharePoint site URL. |
| ApiVersion | Enum System.Integration.Graph."Graph API Version" |
The Graph API version to use. |
| GraphAuthorization | Interface System.Integration.Graph.Authorization."Graph Authorization" |
The Graph API authorization to use. |
| HttpClientHandler | Interface System.RestClient."Http Client Handler" |
HTTP client handler for intercepting requests. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetLists
Gets all lists from the SharePoint site.
procedure GetLists(var GraphLists: Record "SharePoint Graph List" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphLists | Table System.Integration.Sharepoint."SharePoint Graph List" |
Collection of the result (temporary record). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetLists
Gets all lists from the SharePoint site.
procedure GetLists(var GraphLists: Record "SharePoint Graph List" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphLists | Table System.Integration.Sharepoint."SharePoint Graph List" |
Collection of the result (temporary record). |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetList
Gets a SharePoint list by ID.
procedure GetList(ListId: Text; var GraphList: Record "SharePoint Graph List" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ListId | Text |
ID of the list to retrieve. |
| GraphList | Table System.Integration.Sharepoint."SharePoint Graph List" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetList
Gets a SharePoint list by ID.
procedure GetList(ListId: Text; var GraphList: Record "SharePoint Graph List" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ListId | Text |
ID of the list to retrieve. |
| GraphList | Table System.Integration.Sharepoint."SharePoint Graph List" |
Record to store the result. |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
CreateList
Creates a new SharePoint list.
procedure CreateList(DisplayName: Text; Description: Text; var GraphList: Record "SharePoint Graph List" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DisplayName | Text |
Display name for the list. |
| Description | Text |
Description for the list. |
| GraphList | Table System.Integration.Sharepoint."SharePoint Graph List" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Manage.All
CreateList
Creates a new SharePoint list.
procedure CreateList(DisplayName: Text; ListTemplate: Text; Description: Text; var GraphList: Record "SharePoint Graph List" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DisplayName | Text |
Display name for the list. |
| ListTemplate | Text |
Template for the list (genericList, documentLibrary, etc.) |
| Description | Text |
Description for the list. |
| GraphList | Table System.Integration.Sharepoint."SharePoint Graph List" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Manage.All
GetListItems
Gets items from a SharePoint list.
procedure GetListItems(ListId: Text; var GraphListItems: Record "SharePoint Graph List Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ListId | Text |
ID of the list. |
| GraphListItems | Table System.Integration.Sharepoint."SharePoint Graph List Item" |
Collection of the result (temporary record). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetListItems
Gets items from a SharePoint list.
procedure GetListItems(ListId: Text; var GraphListItems: Record "SharePoint Graph List Item" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ListId | Text |
ID of the list. |
| GraphListItems | Table System.Integration.Sharepoint."SharePoint Graph List Item" |
Collection of the result (temporary record). |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
CreateListItem
Creates a new item in a SharePoint list.
procedure CreateListItem(ListId: Text; FieldsJsonObject: JsonObject; var GraphListItem: Record "SharePoint Graph List Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ListId | Text |
ID of the list. |
| FieldsJsonObject | JsonObject |
JSON object containing the fields for the new item. |
| GraphListItem | Table System.Integration.Sharepoint."SharePoint Graph List Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
CreateListItem
Creates a new item in a SharePoint list with a simple title.
procedure CreateListItem(ListId: Text; Title: Text; var GraphListItem: Record "SharePoint Graph List Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ListId | Text |
ID of the list. |
| Title | Text |
Title for the new item. |
| GraphListItem | Table System.Integration.Sharepoint."SharePoint Graph List Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
GetDefaultDrive
Gets the default document library (drive) for the site.
procedure GetDefaultDrive(var DriveId: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the default drive. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDrives
Gets all drives (document libraries) available on the site with detailed information.
procedure GetDrives(var GraphDrives: Record "SharePoint Graph Drive" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphDrives | Table System.Integration.Sharepoint."SharePoint Graph Drive" |
Collection of the result (temporary record). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDrives
Gets all drives (document libraries) available on the site with detailed information.
procedure GetDrives(var GraphDrives: Record "SharePoint Graph Drive" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphDrives | Table System.Integration.Sharepoint."SharePoint Graph Drive" |
Collection of the result (temporary record). |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDrive
Gets a drive (document library) by ID with detailed information.
procedure GetDrive(DriveId: Text; var GraphDrive: Record "SharePoint Graph Drive" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive to retrieve. |
| GraphDrive | Table System.Integration.Sharepoint."SharePoint Graph Drive" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDrive
Gets a drive (document library) by ID with detailed information.
procedure GetDrive(DriveId: Text; var GraphDrive: Record "SharePoint Graph Drive" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive to retrieve. |
| GraphDrive | Table System.Integration.Sharepoint."SharePoint Graph Drive" |
Record to store the result. |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDefaultDrive
Gets the default document library (drive) for the site with detailed information.
procedure GetDefaultDrive(var GraphDrive: Record "SharePoint Graph Drive" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphDrive | Table System.Integration.Sharepoint."SharePoint Graph Drive" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetRootItems
Gets items in the root folder of the default drive.
procedure GetRootItems(var GraphDriveItems: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphDriveItems | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Collection of the result (temporary record). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetRootItems
Gets items in the root folder of the default drive.
procedure GetRootItems(var GraphDriveItems: Record "SharePoint Graph Drive Item" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| GraphDriveItems | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Collection of the result (temporary record). |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetFolderItems
Gets children of a folder by the folder's ID.
procedure GetFolderItems(FolderId: Text; var GraphDriveItems: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderId | Text |
ID of the folder. |
| GraphDriveItems | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Collection of the result (temporary record). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetFolderItems
Gets children of a folder by the folder's ID.
procedure GetFolderItems(FolderId: Text; var GraphDriveItems: Record "SharePoint Graph Drive Item" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderId | Text |
ID of the folder. |
| GraphDriveItems | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Collection of the result (temporary record). |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetItemsByPath
Gets items from a path in the default drive.
procedure GetItemsByPath(FolderPath: Text; var GraphDriveItems: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path to the folder (e.g., 'Documents/Folder1'). |
| GraphDriveItems | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Collection of the result (temporary record). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetItemsByPath
Gets items from a path in the default drive.
procedure GetItemsByPath(FolderPath: Text; var GraphDriveItems: Record "SharePoint Graph Drive Item" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path to the folder (e.g., 'Documents/Folder1'). |
| GraphDriveItems | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Collection of the result (temporary record). |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDriveItem
Gets a file or folder by ID.
procedure GetDriveItem(ItemId: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the item to retrieve. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDriveItem
Gets a file or folder by ID.
procedure GetDriveItem(ItemId: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the item to retrieve. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDriveItemByPath
Gets a file or folder by path.
procedure GetDriveItemByPath(ItemPath: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemPath | Text |
Path to the item (e.g., 'Documents/file.docx'). |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
GetDriveItemByPath
Gets a file or folder by path.
procedure GetDriveItemByPath(ItemPath: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; GraphOptionalParameters: Codeunit "Graph Optional Parameters"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemPath | Text |
Path to the item (e.g., 'Documents/file.docx'). |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
CreateFolder
Creates a new folder.
procedure CreateFolder(FolderPath: Text; FolderName: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path where to create the folder (e.g., 'Documents'). |
| FolderName | Text |
Name of the new folder. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
CreateFolder
Creates a new folder with specified conflict behavior.
procedure CreateFolder(FolderPath: Text; FolderName: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; ConflictBehavior: Enum "Graph ConflictBehavior"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path where to create the folder (e.g., 'Documents'). |
| FolderName | Text |
Name of the new folder. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| ConflictBehavior | Enum System.Integration.Graph."Graph ConflictBehavior" |
How to handle conflicts if a folder with the same name exists |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
CreateFolder
Creates a new folder in a specific drive (document library).
procedure CreateFolder(DriveId: Text; FolderPath: Text; FolderName: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive (document library). |
| FolderPath | Text |
Path where to create the folder (e.g., 'Documents'). |
| FolderName | Text |
Name of the new folder. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
CreateFolder
Creates a new folder in a specific drive (document library) with specified conflict behavior.
procedure CreateFolder(DriveId: Text; FolderPath: Text; FolderName: Text; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; ConflictBehavior: Enum "Graph ConflictBehavior"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive (document library). |
| FolderPath | Text |
Path where to create the folder (e.g., 'Documents'). |
| FolderName | Text |
Name of the new folder. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| ConflictBehavior | Enum System.Integration.Graph."Graph ConflictBehavior" |
How to handle conflicts if a folder with the same name exists |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadFile
Uploads a file to a folder on the default drive.
procedure UploadFile(FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadFile
Uploads a file to a folder on the default drive with specified conflict behavior.
procedure UploadFile(FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; ConflictBehavior: Enum "Graph ConflictBehavior"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| ConflictBehavior | Enum System.Integration.Graph."Graph ConflictBehavior" |
How to handle conflicts if a file with the same name exists |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadFile
Uploads a file to a folder in a specific drive (document library).
procedure UploadFile(DriveId: Text; FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive (document library). |
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadFile
Uploads a file to a folder in a specific drive (document library) with specified conflict behavior.
procedure UploadFile(DriveId: Text; FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; ConflictBehavior: Enum "Graph ConflictBehavior"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive (document library). |
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| ConflictBehavior | Enum System.Integration.Graph."Graph ConflictBehavior" |
How to handle conflicts if a file with the same name exists |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
DownloadFile
Downloads a file.
procedure DownloadFile(ItemId: Text; var TempBlob: Codeunit "Temp Blob"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the file to download. |
| TempBlob | Codeunit System.Utilities."Temp Blob" |
TempBlob to receive the file content. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
DownloadFileByPath
Downloads a file by path.
procedure DownloadFileByPath(FilePath: Text; var TempBlob: Codeunit "Temp Blob"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FilePath | Text |
Path to the file (e.g., 'Documents/file.docx'). |
| TempBlob | Codeunit System.Utilities."Temp Blob" |
TempBlob to receive the file content. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
DownloadLargeFile
Downloads a large file using chunked download for files larger than Business Central's 150MB HTTP response limit.
procedure DownloadLargeFile(ItemId: Text; var TempBlob: Codeunit "Temp Blob"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the file to download. |
| TempBlob | Codeunit System.Utilities."Temp Blob" |
TempBlob to receive the file content. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All. Uses 100MB chunks to stay under the 150MB limit. Any chunk failure will fail the entire download.
DownloadLargeFileByPath
Downloads a large file by path using chunked download for files larger than Business Central's 150MB HTTP response limit.
procedure DownloadLargeFileByPath(FilePath: Text; var TempBlob: Codeunit "Temp Blob"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FilePath | Text |
Path to the file (e.g., 'Documents/file.docx'). |
| TempBlob | Codeunit System.Utilities."Temp Blob" |
Blob to receive the file content. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All. Uses 100MB chunks to stay under the 150MB limit. Any chunk failure will fail the entire download.
UploadLargeFile
Uploads a large file to a folder on the default drive using chunked upload for improved performance and reliability.
procedure UploadLargeFile(FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadLargeFile
Uploads a large file to a folder on the default drive using chunked upload with specified conflict behavior.
procedure UploadLargeFile(FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; ConflictBehavior: Enum "Graph ConflictBehavior"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| ConflictBehavior | Enum System.Integration.Graph."Graph ConflictBehavior" |
How to handle conflicts if a file with the same name exists |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadLargeFile
Uploads a large file to a folder in a specific drive (document library) using chunked upload.
procedure UploadLargeFile(DriveId: Text; FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive (document library). |
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
UploadLargeFile
Uploads a large file to a folder in a specific drive (document library) using chunked upload with specified conflict behavior.
procedure UploadLargeFile(DriveId: Text; FolderPath: Text; FileName: Text; FileInStream: InStream; var GraphDriveItem: Record "SharePoint Graph Drive Item" temporary; ConflictBehavior: Enum "Graph ConflictBehavior"): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
ID of the drive (document library). |
| FolderPath | Text |
Path to the folder (e.g., 'Documents'). |
| FileName | Text |
Name of the file to upload. |
| FileInStream | InStream |
Content of the file. |
| GraphDriveItem | Table System.Integration.Sharepoint."SharePoint Graph Drive Item" |
Record to store the result. |
| ConflictBehavior | Enum System.Integration.Graph."Graph ConflictBehavior" |
How to handle conflicts if a file with the same name exists |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All
DeleteItem
Deletes a drive item (file or folder) by ID.
procedure DeleteItem(ItemId: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the item to delete. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All. Returns success even if the item doesn't exist (404 is treated as success).
DeleteItemByPath
Deletes a drive item (file or folder) by path.
procedure DeleteItemByPath(ItemPath: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemPath | Text |
Path to the item (e.g., 'Documents/file.docx' or 'Documents/folder'). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All. Returns success even if the item doesn't exist (404 is treated as success).
ItemExists
Checks if a drive item (file or folder) exists by ID.
procedure ItemExists(ItemId: Text; var Exists: Boolean): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the item to check. |
| Exists | Boolean |
True if the item exists, false if it doesn't exist (404). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
ItemExistsByPath
Checks if a drive item (file or folder) exists by path.
procedure ItemExistsByPath(ItemPath: Text; var Exists: Boolean): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemPath | Text |
Path to the item (e.g., 'Documents/file.docx' or 'Documents/folder'). |
| Exists | Boolean |
True if the item exists, false if it doesn't exist (404). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.Read.All
CopyItem
Copies a drive item (file or folder) to a new location by ID.
procedure CopyItem(ItemId: Text; TargetFolderId: Text; NewName: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the item to copy. |
| TargetFolderId | Text |
ID of the target folder. |
| NewName | Text |
New name for the copied item (optional - leave empty to keep original name). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All. This is an asynchronous operation. The copy happens in the background.
CopyItemByPath
Copies a drive item (file or folder) to a new location by path.
procedure CopyItemByPath(ItemPath: Text; TargetFolderPath: Text; NewName: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemPath | Text |
Path to the item (e.g., 'Documents/file.docx'). |
| TargetFolderPath | Text |
Path to the target folder (e.g., 'Documents/Archive'). |
| NewName | Text |
New name for the copied item (optional - leave empty to keep original name). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All. This is an asynchronous operation. The copy happens in the background.
MoveItem
Moves a drive item (file or folder) to a new location by ID.
procedure MoveItem(ItemId: Text; TargetFolderId: Text; NewName: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemId | Text |
ID of the item to move. |
| TargetFolderId | Text |
ID of the target folder (leave empty to only rename). |
| NewName | Text |
New name for the moved item (leave empty to keep original name). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All. At least one of TargetFolderId or NewName must be provided.
MoveItemByPath
Moves a drive item (file or folder) to a new location by path.
procedure MoveItemByPath(ItemPath: Text; TargetFolderPath: Text; NewName: Text): Codeunit "SharePoint Graph Response"
Parameters
| Name | Type | Description |
|---|---|---|
| ItemPath | Text |
Path to the item (e.g., 'Documents/file.docx'). |
| TargetFolderPath | Text |
Path to the target folder (leave empty to only rename). |
| NewName | Text |
New name for the moved item (leave empty to keep original name). |
Returns
| Type | Description |
|---|---|
| Codeunit System.Integration.Sharepoint."SharePoint Graph Response" |
An operation response object containing the result of the operation. |
Remarks
Required Microsoft Graph permission: Sites.ReadWrite.All. At least one of TargetFolderPath or NewName must be provided.
SetODataFilter
Creates an OData query to filter items in SharePoint
procedure SetODataFilter(var GraphOptionalParameters: Codeunit "Graph Optional Parameters"; Filter: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
The optional parameters to configure |
| Filter | Text |
The OData filter expression |
Remarks
Use this for $filter OData queries
SetODataSelect
Creates an OData query to select specific fields from items in SharePoint
procedure SetODataSelect(var GraphOptionalParameters: Codeunit "Graph Optional Parameters"; Select: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
The optional parameters to configure |
| Select | Text |
The fields to select (comma-separated) |
Remarks
Use this for $select OData queries
SetODataExpand
Creates an OData query to expand related entities in SharePoint
procedure SetODataExpand(var GraphOptionalParameters: Codeunit "Graph Optional Parameters"; Expand: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
The optional parameters to configure |
| Expand | Text |
The entities to expand (comma-separated) |
Remarks
Use this for $expand OData queries
SetODataOrderBy
Creates an OData query to order results in SharePoint
procedure SetODataOrderBy(var GraphOptionalParameters: Codeunit "Graph Optional Parameters"; OrderBy: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
The optional parameters to configure |
| OrderBy | Text |
The fields to order by (e.g. "displayName asc") |
Remarks
Use this for $orderby OData queries
GetDiagnostics
Returns detailed information on last API call.
procedure GetDiagnostics(): Interface "HTTP Diagnostics"
Returns
| Type | Description |
|---|---|
| Interface System.Integration.Sharepoint."HTTP Diagnostics" |
Codeunit holding http response status, reason phrase, headers and possible error information for the last API call |