Codeunit "Sharepoint Storage UTCAP"
Propose un ensemble de fonctionnalités pour accéder aux lecteurs et aux fichiers de Sharepoint. Ce module requiert une inscription d'application dans le tenant AAD visé au niveau administrateur pour laquelle les autorisations d'API suivantes doivent être activées :
- Sites.ReadWrite.All
Examples
Lister les sites
``` AL
var
SharepointStorage: Codeunit "Sharepoint Storage UTCAP";
Sites: JsonArray;
SiteTok, NameTok: JsonToken;
SiteNames: TextBuilder;
begin
SharepointStorage.Initialize('client_id', 'client_secret', 'mydomain.fr');
SharepointStorage.GetSites(Sites);
foreach (SiteTok in Sites) begin
SiteTok.AsObject().Get('name', NameTok);
SiteNames.AppendLine(NameTok.AsValue().AsText());
end;
Message(SiteNames.ToText());
end;
```
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
Initialize
Initialise cette instance de stockage SharePoint.
[NonDebuggable]
procedure Initialize(NewClientID: Text, NewClientSecret: Text, NewTenantId: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| NewClientID | Text |
Parameter of type Text. |
| NewClientSecret | Text |
Parameter of type Text. |
| NewTenantId | Text |
Parameter of type Text. |
GetSites
Obtient la liste des sites.
[TryFunction]
procedure GetSites(var Sites: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Sites | JsonArray |
Parameter of type JsonArray. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetSites
Renvoie la liste des sites enfants du site spécifié.
[TryFunction]
procedure GetSites(ParentSiteId: Text, var Sites: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| ParentSiteId | Text |
Parameter of type Text. |
| Sites | JsonArray |
Parameter of type JsonArray. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetDrives
Renvoie la liste des lecteurs.
[TryFunction]
procedure GetDrives(var Drives: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Drives | JsonArray |
Parameter of type JsonArray. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetSiteDrives
Renvoie la liste des lecteurs d'un site.
[TryFunction]
procedure GetSiteDrives(SiteId: Text, var Drives: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| SiteId | Text |
Parameter of type Text. |
| Drives | JsonArray |
Parameter of type JsonArray. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetGroupDrives
Renvoie la liste des lecteurs d'un groupe.
[TryFunction]
procedure GetGroupDrives(GroupId: Text, var Drives: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| GroupId | Text |
Parameter of type Text. |
| Drives | JsonArray |
Parameter of type JsonArray. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetDriveChildItemsFromItemId
Renvoie la liste des enfants d'un élément spécifié propre au lecteur.
[TryFunction]
procedure GetDriveChildItemsFromItemId(DriveId: Text, ItemId: Text, var Children: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ItemId | Text |
Parameter of type Text. |
| Children | JsonArray |
Parameter of type JsonArray. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetDriveItemFromPath
Renvoie un élément d'un lecteur.
[TryFunction]
procedure GetDriveItemFromPath(DriveId: Text, Path: Text, var Item: JsonObject): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| Path | Text |
Parameter of type Text. |
| Item | JsonObject |
Parameter of type JsonObject. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetDriveItem
Renvoie un élément d'un lecteur.
[TryFunction]
procedure GetDriveItem(DriveId: Text, ItemId: Text, var Item: JsonObject): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ItemId | Text |
Parameter of type Text. |
| Item | JsonObject |
Parameter of type JsonObject. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetDriveRootItem
Renvoie l'élément racine d'un lecteur.
[TryFunction]
procedure GetDriveRootItem(DriveId: Text, var Item: JsonObject): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| Item | JsonObject |
Parameter of type JsonObject. |
Returns
| Type | Description |
|---|---|
| Boolean |
CreateDriveFolderFromParentId
Créé un nouveau dossier enfant à l'élément parent spécifié.
[TryFunction]
procedure CreateDriveFolderFromParentId(DriveId: Text, ParentItemId: Text, FolderName: Text, var ResponsePayload: JsonObject): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ParentItemId | Text |
Parameter of type Text. |
| FolderName | Text |
Parameter of type Text. |
| ResponsePayload | JsonObject |
Parameter of type Text. |
Returns
| Type | Description |
|---|---|
| Boolean |
CreateDriveFolderFromParentId
Créé un nouveau dossier enfant à l'élément parent spécifié.
[TryFunction]
procedure CreateDriveFolderFromParentId(DriveId: Text, ParentItemId: Text, FolderName: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ParentItemId | Text |
Parameter of type Text. |
| FolderName | Text |
Parameter of type Text. |
Returns
| Type | Description |
|---|---|
| Boolean |
DeleteDriveItem
Supprime un élément du lecteur (fichier ou dossier).
[TryFunction]
procedure DeleteDriveItem(DriveId: Text, ItemId: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ItemId | Text |
Parameter of type Text. |
Returns
| Type | Description |
|---|---|
| Boolean |
UploadDriveFile
Télécharge un fichier à l'emplacement spécifié.
[TryFunction]
procedure UploadDriveFile(DriveId: Text, ParentItemId: Text, Filename: Text, DocumentStream: InStream, var ResponsePayload: JsonObject): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ParentItemId | Text |
Parameter of type Text. |
| Filename | Text |
Parameter of type Text. |
| DocumentStream | InStream |
Parameter of type InStream. |
| ResponsePayload | JsonObject |
Parameter of type Text. |
Returns
| Type | Description |
|---|---|
| Boolean |
UploadDriveFile
Télécharge un fichier à l'emplacement spécifié.
[TryFunction]
procedure UploadDriveFile(DriveId: Text, ParentItemId: Text, Filename: Text, DocumentStream: InStream): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| ParentItemId | Text |
Parameter of type Text. |
| Filename | Text |
Parameter of type Text. |
| DocumentStream | InStream |
Parameter of type InStream. |
Returns
| Type | Description |
|---|---|
| Boolean |
BrowseForFolder
Ouvre une boûte de dialogue pour parcourir et sélectionnner un dossier dans un lecteur.
procedure BrowseForFolder(DriveId: Text, StartItemId: Text, NewFolderAllowed: Boolean, var SelectedItemId: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| DriveId | Text |
Parameter of type Text. |
| StartItemId | Text |
Parameter of type Text. |
| NewFolderAllowed | Boolean |
Parameter of type Text. |
| SelectedItemId | Text |
Parameter of type Text. |
Returns
| Type | Description |
|---|---|
| Boolean |
Return variable "Boolean". |