Microsoft graph api 使用图形API在Sharepoint中创建文件夹时出错
我试图在Sharepoint中创建子文件夹,但收到错误。我可以成功创建两个级别的文件夹,但在创建第三个级别时,我收到以下错误: 请求URI无效。绑定到“microsoft.graph.driveItem”的绑定函数不支持转义函数批注 我正在使用Postman并按以下步骤创建文件夹: 1顶层:成功-已创建文件夹1 2第一个子项成功-在Folder1中创建Folder2 第二个孩子失败了Microsoft graph api 使用图形API在Sharepoint中创建文件夹时出错,microsoft-graph-api,Microsoft Graph Api,我试图在Sharepoint中创建子文件夹,但收到错误。我可以成功创建两个级别的文件夹,但在创建第三个级别时,我收到以下错误: 请求URI无效。绑定到“microsoft.graph.driveItem”的绑定函数不支持转义函数批注 我正在使用Postman并按以下步骤创建文件夹: 1顶层:成功-已创建文件夹1 2第一个子项成功-在Folder1中创建Folder2 第二个孩子失败了 对于如何正确创建Folder3文件夹的任何反馈,我们将不胜感激。在最后一个示例中,由于为访问提供的端点中的Fol
对于如何正确创建Folder3文件夹的任何反馈,我们将不胜感激。在最后一个示例中,由于为访问提供的端点中的Folder2指定了无效的Url格式,因此会出现错误:
https://graph.microsoft.com/v1.0/sites/<SITE_ID>/drive/root:/Folder1:/Folder2:/children
|_________________|
^^^
invalid path syntax for accessing Folder2
有关更多详细信息,请参阅
Trying using below code.
Where parentDriveId is root drive ID and driveId is the folder where we try to create folder.
var driveItem = new DriveItem
{
Name = driveName,
Folder = new Folder { },
AdditionalData = new Dictionary<string, object>()
{
{ "@microsoft.graph.conflictBehavior", "rename" }
}
};
createdDriveId = (await graphclient.Drives[parentDriveId].Items[driveId].Children.Request().AddAsync(driveItem)).Id;
https://graph.microsoft.com/v1.0/sites/<SITE_ID>/drive/root:/Folder1:/Folder2:/children
{
"name": "Folder3",
"folder": { },
"@microsoft.graph.conflictBehavior": "replace"
}
https://graph.microsoft.com/v1.0/sites/<SITE_ID>/drive/root:/Folder1:/Folder2:/children
|_________________|
^^^
invalid path syntax for accessing Folder2
https://graph.microsoft.com/v1.0/sites/<SITE_ID>/drive/root:/Folder1/Folder2:/children
Trying using below code.
Where parentDriveId is root drive ID and driveId is the folder where we try to create folder.
var driveItem = new DriveItem
{
Name = driveName,
Folder = new Folder { },
AdditionalData = new Dictionary<string, object>()
{
{ "@microsoft.graph.conflictBehavior", "rename" }
}
};
createdDriveId = (await graphclient.Drives[parentDriveId].Items[driveId].Children.Request().AddAsync(driveItem)).Id;