我正在尝试使用 Microsoft Graph API 从 SharePoint 文档库获取文件夹和文档。
\n\n如果我请求GET,https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/MyDocumentSite:/drives/我会得到这个:
{\n "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",\n "value":[\n {\n "createdDateTime": "2019-09-05T07:09:49Z",\n "description": "",\n "id": "b!wxh2ZWwoT0KKTdLRYjD5jvzjo8jkat5LgY3VyfgEqkv3YVg_XXXXXXXXXXXXXXXX",\n "lastModifiedDateTime": "2019-09-05T07:09:49Z",\n "name": "Documents",\n "webUrl": "https://mysite.sharepoint.com/sites/MyDocumentSite/Shared%20Documents",\n "driveType": "documentLibrary",\n "createdBy":{"user":{"displayName": "System Account" }},\n "lastModifiedBy":{"user":{"email": "me@myorganization.org", "id": "73f9990c-5c92-4839-8b13-XXXXXXXXXXXX", "displayName": "John Smith"\xe2\x80\xa6},\n "quota":{"deleted": 0, "remaining": 0, "total": 0, "used": 0}\n }\n ]\n}\nRun Code Online (Sandbox Code Playgroud)\n\n但是,如果我尝试通过GET对该 id: 执行请求来访问该驱动器https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/MyDocumentSite:/drives/b!wxh2ZWwoT0KKTdLRYjD5jvzjo8jkat5LgY3VyfgEqkv3YVg_XXXXXXXXXXXXXXXX,则会收到 BadRequest 错误:
{\n "error":{\n "code": "BadRequest",\n "message": "Url specified is invalid.",\n "innerError":{\n "request-id": "7c9eaf61-764f-4d72-abdb-ffa2fe868e90",\n "date": "2019-09-16T19:09:41"\n }\n …Run Code Online (Sandbox Code Playgroud) 要求 - 需要访问文档库中的特定文件
文件路径 - 主机名/站点/站点名/共享文档/Folder1/File1
我尝试过这些
https://graph.microsoft.com/v1.0/sites/{host-name}/sites/{site-id}:/drives
https://graph.microsoft.com/v1.0/sites/{host-name}/sites/{site-id}:/drives/{drive-id}/root/children
尝试上面的错误,错误的请求。
我是 MS Graph 的新手,不知道哪里出了问题。任何帮助将不胜感激。
sharepoint microsoft-graph-files power-automate microsoft-graph-api
如何仅使用给定的 Url 使其成为现实,以及是否可能,idk?
我正在尝试做什么:
根据字符串在驱动器中的特定位置创建文件夹。
该字符串由 3 部分组成(每个部分代表文件夹简单!)例如, mystring = "Analyse_General_Theory" ,驱动器中的路径应类似于:Analyse/General/Theory
所以 :
我的解决方案的想象力就是这样:)
将我的 stringUrl 传递给构建请求,然后发布我的文件夹
stringUrl = "https://CompanyDomin.sharepoint.com/sites/mySite/SharedFolders/Analyse/General/Theory"
Run Code Online (Sandbox Code Playgroud)
然后
await graphClient.Request(stringUrl).PostAsync(myLastFolder) !!!
Run Code Online (Sandbox Code Playgroud)
所以才会有这样的结果!
分析/一般/理论/myLastFolder
有这样的东西吗?或者可能类似于这种方法?