问题
我有一个位于以下位置的 Sharepoint 文档库:
https://my-dough-main.sharepoint.com/widgets/Shared%20Documents/Forms/AllItems.aspx
我正在尝试以编程方式(在 c# 中)创建上传会话。但我收到错误“找不到资源”
代码
private readonly siteName string = "my-dough-main.sharepoint.com:/sites/widgets:";
private readonly string largeBlobsDocumentLibraryID = "57575757575-1ccc-4a44-b88e-5ef0fb75249b";
// Create the upload session
//https://docs.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0
// itemPath does not need to be a path to an existing item
var uploadSession = await _graphServiceClient.Site[siteName.]Drives[largeBlobsDocumentLibraryID]
.ItemWithPath("thebogusfile.mp4")
.CreateUploadSession(uploadProps)
.Request()
.PostAsync();
至于我是如何获得 ID 的,我在 Graph Explorer 中运行了这个查询:
https://graph.microsoft.com/v1.0/sites/my-dough-main.sharepoint.com:/sites/widgets:/Drives
在结果集中,我获取了“共享文档”库的 ID。
{
"createdDateTime": "2021-11-07T05:30:15Z",
"description": "",
"id": "this is the value I'm trying",
"lastModifiedDateTime": "2021-11-24T13:54:18Z",
"name": "Documents",
"webUrl": "https://my-dough-main.sharepoint.com/sites/widgets/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"email": "jdoe@outlook.com",
"id": "guid",
"displayName": "Doe john"
}
},
"owner": {
"user": {
"email": "jdoe@outlook.com",
"id": "guid",
"displayName": "Doe John"
}
},
"quota": {
"deleted": 0,
"remaining": 27485528222812,
"state": "normal",
"total": 27487790694400,
"used": 2262471588
}
},
谁能告诉我我在哪里迷路了?到目前为止,我看到的所有示例都使用 Me 位置,但是您如何写入其他位置?谢谢。