如何使用c#Rest API从OneDrive Business获取所有文件的列表?
我想要OneDrive Business上的所有可用文件。 我想在我的应用程序中显示此文件列表。如何使用c#Rest API从OneDrive Business获取所有文件的列表?,c#,onedrive,office365-restapi,C#,Onedrive,Office365 Restapi,我想要OneDrive Business上的所有可用文件。 我想在我的应用程序中显示此文件列表。 还有什么方法可以按类型过滤文件,如照片、视频、文档?OneDrive REST不会返回集合的后代,我们需要迭代每个文件夹以显示文件夹的子文件夹。您可以参考列出一个项目的子项 还有什么方法可以按类型过滤文件,如照片、视频、文档 对。项具有提供有关项的标识和功能的数据的方面。文件夹有一个文件夹方面,文件有一个文件方面。除了文件方面,图像还有一个图像方面。所以我们可以使用这些方面来限制我们想要的文件类型
还有什么方法可以按类型过滤文件,如照片、视频、文档?OneDrive REST不会返回集合的后代,我们需要迭代每个文件夹以显示文件夹的子文件夹。您可以参考列出一个项目的子项 还有什么方法可以按类型过滤文件,如照片、视频、文档 对。项具有提供有关项的标识和功能的数据的方面。文件夹有一个文件夹方面,文件有一个文件方面。除了文件方面,图像还有一个图像方面。所以我们可以使用这些方面来限制我们想要的文件类型 例如,下面是一个仅为具有文件和图像方面的项目筛选搜索结果的示例 请求:
GET /drive/root/view.search?q=vacation&filter=image%20ne%20null%20and%20file%20ne%20null
HTTP/1.1 200 OK
Content-type: application/json
Content-length: length
{
"value": [
{
"id": "0123456789abc!123",
"name": "Vacation.jpg",
"image": { },
"file": { },
"searchResult":
{
"onClickTelemetryUrl": "https://bing.com/0123456789abc!123"
}
},
{
"id": "0123456789abc!456",
"name": "Summer.jpg",
"image": { },
"file": { },
"searchResult":
{
"onClickTelemetryUrl": "https://bing.com/0123456789abc!456"
}
}
],
"@search.approximateCount": 12,
"@odata.nextLink": "https://api.onedrive.com/drive/root/view.search?query=vacation&skipToken=1asdlnjnkj1nalkm!asd"
}
响应:
GET /drive/root/view.search?q=vacation&filter=image%20ne%20null%20and%20file%20ne%20null
HTTP/1.1 200 OK
Content-type: application/json
Content-length: length
{
"value": [
{
"id": "0123456789abc!123",
"name": "Vacation.jpg",
"image": { },
"file": { },
"searchResult":
{
"onClickTelemetryUrl": "https://bing.com/0123456789abc!123"
}
},
{
"id": "0123456789abc!456",
"name": "Summer.jpg",
"image": { },
"file": { },
"searchResult":
{
"onClickTelemetryUrl": "https://bing.com/0123456789abc!456"
}
}
],
"@search.approximateCount": 12,
"@odata.nextLink": "https://api.onedrive.com/drive/root/view.search?query=vacation&skipToken=1asdlnjnkj1nalkm!asd"
}