使用 Microsoft Graph 中的Microsoft 搜索 API 搜索 SharePoint Embedded 容器和内容。 搜索 API 允许通过在请求正文中指定相应的参数来限定查询的容器类型和文件类型。 本文介绍一些示例。
注意
- 搜索 SharePoint Embedded 内容处于预览阶段,可能会发生更改。 请参阅描述其当前权限要求的 异常访问模式 。
- 搜索 API 仅支持委托的权限。
- 如果应用程序已选择退出 Microsoft 365 中的内容可发现性,则搜索请求必须指定并设置
includeHiddenContent
参数。 详细了解 SharePoint Embedded 内容可发现性。
示例 1:按容器类型搜索容器
本示例按指定的容器类型查询所有容器,SharePoint Embedded 应用程序在 Microsoft 365 上选择退出内容可发现性。 响应包括租户中指定容器类型 (drive
) 的所有容器实例:
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"drive"
],
"query": {
"queryString": "ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
},
"sharePointOneDriveOptions": {
"includeHiddenContent": true
}
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [],
"hitsContainers": [
{
"hits": [
{
"hitId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"rank": 1,
"summary": "Everything about Contoso",
"resource": {
"@odata.type": "#microsoft.graph.drive",
"id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"createdBy": {
"user": {
"displayName": "Dylan Williams"
}
},
"lastModifiedDateTime": "2024-01-18T19:45:25Z",
"name": "AllItems.aspx",
"parentReference": {
"sharepointIds": {
"listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4"
},
"siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
},
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/Forms/AllItems.aspx"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
示例 2:按标题搜索容器
此示例按指定的容器显示名称查询所有容器,SharePoint Embedded 应用程序在 Microsoft 365 上未选择退出内容可发现性。 响应包括租户中符合条件的所有容器实例:
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"drive"
],
"query": {
"queryString": "Title:'contoso' AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
}
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [
"contoso"
],
"hitsContainers": [
{
"hits": [
{
"hitId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"rank": 1,
"summary": "Everything about Contoso",
"resource": {
"@odata.type": "#microsoft.graph.drive",
"id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"createdBy": {
"user": {
"displayName": "Dylan Williams"
}
},
"lastModifiedDateTime": "2024-01-18T19:45:25Z",
"name": "AllItems.aspx",
"parentReference": {
"sharepointIds": {
"listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4"
},
"siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
},
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/Forms/AllItems.aspx"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
示例 3:按容器说明搜索容器
此示例按指定的容器类型和容器说明查询所有容器,SharePoint Embedded 应用程序在 Microsoft 365 上选择退出内容可发现性。 响应包括租户中符合条件的所有容器实例:
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"drive"
],
"query": {
"queryString": "Description:'Everything' AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
},
"sharePointOneDriveOptions": {
"includeHiddenContent": true
}
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [],
"hitsContainers": [
{
"hits": [
{
"hitId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"rank": 1,
"summary": "<c0>Everything</c0> about Contoso<ddd/>",
"resource": {
"@odata.type": "#microsoft.graph.drive",
"id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"createdBy": {
"user": {
"displayName": "Dylan Williams"
}
},
"lastModifiedDateTime": "2024-01-18T19:45:25Z",
"name": "AllItems.aspx",
"parentReference": {
"sharepointIds": {
"listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4"
},
"siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
},
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/Forms/AllItems.aspx"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
示例 4:在特定容器中按标题搜索内容
本示例按特定容器实例中的特定标题查询所有内容,SharePoint Embedded 应用程序在 Microsoft 365 上选择退出内容可发现性。 响应包括 driveItems
符合条件的特定容器实例中的所有内容:
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "Title:'contoso' AND ContainerId:b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0"
},
"sharePointOneDriveOptions": {
"includeHiddenContent": true
}
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [
"contoso",
"b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0"
],
"hitsContainers": [
{
"hits": [
{
"hitId": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
"rank": 1,
"summary": "Contoso Detailed Design Contoso Product Specification",
"resource": {
"@odata.type": "#microsoft.graph.driveItem",
"size": 56,
"fileSystemInfo": {
"createdDateTime": "2024-01-18T19:46:48Z",
"lastModifiedDateTime": "2024-01-18T19:46:48Z"
},
"listItem": {
"@odata.type": "#microsoft.graph.listItem",
"fields": {},
"id": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
},
"id": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
"createdBy": {
"user": {
"displayName": "Dylan Williams",
"email": "dywilliams@contoso.onmicrosoft.com"
}
},
"createdDateTime": "2024-01-18T19:46:48Z",
"lastModifiedBy": {
"user": {
"displayName": "Dylan Williams",
"email": "dywilliams@contoso.onmicrosoft.com"
}
},
"lastModifiedDateTime": "2024-01-18T19:46:48Z",
"name": "contoso.txt",
"parentReference": {
"driveId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"id": "01SHAK4OVPJ5Q5P6YD6VCZHPV7PKILUJ65",
"sharepointIds": {
"listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4",
"listItemId": "1",
"listItemUniqueId": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
},
"siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
},
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/contoso.txt"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
示例 5:按内容搜索
此示例在特定容器类型的所有容器中按指定字词查询所有内容,SharePoint Embedded 应用程序在 Microsoft 365 上选择退出内容可发现性。 响应包括与条件匹配的所有 driveItems
内容:
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "'contoso' AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
},
"sharePointOneDriveOptions": {
"includeHiddenContent": true
}
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)"
"value": [
{
"searchTerms": [
"contoso"
],
"hitsContainers": [
{
"hits": [
{
"hitId": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
"rank": 1,
"summary": "<c0>Contoso</c0> Detailed Design <c0>Contoso</c0> Product Specification<ddd/>",
"resource": {
"@odata.type": "#microsoft.graph.driveItem",
"size": 56,
"fileSystemInfo": {
"createdDateTime": "2024-01-18T19:46:48Z",
"lastModifiedDateTime": "2024-01-18T19:46:48Z"
},
"listItem": {
"@odata.type": "#microsoft.graph.listItem",
"fields": {},
"id": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
},
"id": "01SHAK4OWIBDXV4NG2JVFLSGUXVKZ5VF5E",
"createdBy": {
"user": {
"displayName": "Dylan Williams",
"email": "dywilliams@contoso.onmicrosoft.com"
}
},
"createdDateTime": "2024-01-18T19:46:48Z",
"lastModifiedBy": {
"user": {
"displayName": "Dylan Williams",
"email": "dywilliams@contoso.onmicrosoft.com"
}
},
"lastModifiedDateTime": "2024-01-18T19:46:48Z",
"name": "contoso.txt",
"parentReference": {
"driveId": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"id": "01SHAK4OVPJ5Q5P6YD6VCZHPV7PKILUJ65",
"sharepointIds": {
"listId": "26d6a67d-bd07-4646-9c5b-85b0e519d6f4",
"listItemId": "1",
"listItemUniqueId": "5eef08c8-da34-4a4d-b91a-97aab3da97a4"
},
"siteId": "contoso.sharepoint.com,05031a50-e9c7-474c-889e-7cf44659a5b2,e00b849e-3cec-4ade-8f7b-96d1f0f598fa"
},
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_05031a50-e9c7-474c-889e-7cf44659a5b2/Document Library/contoso.txt"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
示例 6:按容器自定义属性搜索容器
本示例通过指定的自定义属性键:值对查询所有容器,以及已选择退出 Microsoft 365 上的内容可发现性的 SharePoint Embedded 应用程序。 响应包括符合以下条件的所有容器:
注意
自定义属性名称必须在查询字符串中追加文本“OWSTEXT”。
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"drive"
],
"query": {
"queryString": "customPropertyNametOWSTEXT:customPropertyValue AND ContainerTypeId:498c6855-8f0e-0de7-142e-4e9ff86af9ae"
},
"sharePointOneDriveOptions": {
"includeHiddenContent": true
}
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [],
"hitsContainers": [
{
"hits": [
{
"hitId": "b!C4Psl-ZZZkaZINVay8RKt2fqu3agJbVNlIUjNuIzqlPhOJMrr7ThS4aR8L8XdZu4",
"rank": 1,
"summary": "Everything about Contoso",
"resource": {
"@odata.type": "#microsoft.graph.drive",
"id": "b!UBoDBcfpTEeInnz0Rlmlsp6EC-DsPN5Kj3uW0fD1mPp9ptYmB71GRpxbhbDlGdb0",
"createdBy": {
"user": {
"displayName": "Dylan Williams"
}
},
"lastModifiedDateTime": "2024-08-02T17:31:06Z",
"name": "AllItems.aspx",
"parentReference": {
"sharepointIds": {
"listId": "2b9338e1-b4af-4be1-8691-f0bf17759bb8"
},
"siteId": "contoso.sharepoint.com,97ec830b-59e6-4666-9920-d55acbc44ab7,76bbea67-25a0-4db5-9485-2336e233aa53"
},
"webUrl": "https://contoso.sharepoint.com/contentstorage/CSP_97ec830b-59e6-4666-9920-d55acbc44ab7/Document Library/Forms/AllItems.aspx"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
示例 7:在响应正文中搜索具有特定内容属性的内容,并对结果进行排序
此示例按特定字词查询容器内容,并要求响应包含内容上的所有指定属性。 可排序的属性可用于对结果进行排序。
请求
POST /search/query
Content-Type: application/json
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "Everything about contoso"
},
"sharePointOneDriveOptions": {
"includeHiddenContent": true
},
"fields": [
"SampleOWSText",
"id",
"name",
"parentReference",
"file",
"folder",
"webUrl",
"createdDateTime",
"lastModifiedDateTime",
"size",
"fileSystemInfo",
"createdBy",
"lastModifiedBy",
"fileSystemInfo",
"fileSystemInfo"
],
"sortProperties": [
{
"name": "Created",
"isDescending": false
}
]
}
]
}
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [
"everything",
"about",
"contoso"
],
"hitsContainers": [
{
"hits": [
{
"hitId": "017JL52SWZQ2M5MULUKFBIL7SZ56EB4V2Z",
"rank": 1,
"summary": "Everything about Contoso",
"resource": {
"@odata.type": "#microsoft.graph.driveItem",
"size": 17363,
"fileSystemInfo": {
"createdDateTime": "2024-06-20T21:49:03Z",
"lastModifiedDateTime": "2024-04-01T16:57:00Z"
},
"listItem": {
"@odata.type": "#microsoft.graph.listItem",
"id": "d69986d9-7451-4251-85fe-59ef881e5759",
"fields": {
"sampleOWSText": "Sample Value",
"id": "AAAAAH_MwHAjYctMtjgTN1cWJnYHAApvY20ubJFGtzLui9sETKcAAAAAASsAAApvY20ubJFGtzLui9sETKcAAAAAJqsAAA2",
"size": 17363,
"createdBy": "Dylan Williams"
}
},
"id": "017JL52SWZQ2M5MULUKFBIL7SZ56EB4V2Z",
"createdBy": {
"user": {
"displayName": "Dylan Williams",
"email": "dywilliams@contoso.onmicrosoft.com"
}
},
"createdDateTime": "2024-06-20T21:49:03Z",
"lastModifiedBy": {
"user": {
"displayName": "Dylan Williams",
"email": "dywilliams@contoso.onmicrosoft.com"
}
},
"lastModifiedDateTime": "2024-04-01T16:57:00Z",
"name": "Constoso Details.docx",
"parentReference": {
"driveId": "b!rWzsZXXFWEOeeP31bSE5BTjn_6qC3dFNloUBMv62EMilewHuRwQrQau-zcJu2BT0",
"id": "017JL52SXQSKBKPB7VKZCJE5ZSWUN4LZDZ",
"sharepointIds": {
"listId": "ee017ba5-0447-412b-abbe-cdc26ed814f4",
"listItemId": "1",
"listItemUniqueId": "d69986d9-7451-4251-85fe-59ef881e5759"
},
"siteId": "contoso.sharepoint.com,65ec6cad-c575-4358-9e78-fdf56d213905,aaffe738-dd82-4dd1-9685-0132feb610c8"
},
"webUrl": "https://contoso.sharepointt.com/contentstorage/CSP_65ec6cad-c575-4358-9e78-fdf56d213905/Document Library/Constoso Details.docx"
}
}
],
"total": 1,
"moreResultsAvailable": false
}
]
}
]
}
已知限制
- 搜索请求在已登录用户的上下文中运行。 搜索结果的范围仅限于强制用户对项目应用的任何访问控制。 例如,搜索结果将包括与搜索条件匹配且可供用户访问的所有容器或容器内容,而不管 SharePoint Embedded 应用程序是否有权访问。 在搜索容器或容器内容时,应通过将 ContainerTypeId 作为 queryString 的一部分来指定所需的容器类型,以确保搜索结果的范围正确。
- 应用程序必须对相应的容器类型具有访问权限,才能访问搜索结果中的容器或容器内容。
枚举 (筛选) SharePoint Embedded 内容
还可以使用 URL 参数枚举内容,以返回 SharePoint Embedded 容器中的特定内容。 这不使用搜索 API 来检索项。 有关参考,请参阅 枚举查询参数 。
示例 1:通过特定的列属性枚举内容并查看结果
此示例通过项上的列属性枚举指定的容器内容:
请求
GET https://graph.microsoft.com/v1.0/drives/{{ContainerID}}/items?$filter=startswith(listitem/fields/{{ColumnProperty}}, '{{Value}}')&$expand=listitem($expand=fields)
响应
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF')/items(listItem(fields()))",
"value": [
{
"@odata.etag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
"@microsoft.graph.downloadUrl": "https://<tenant>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe/_layouts/15/download.aspx?UniqueId=b8051d89-836e-4b8e-bd2b-7634bac92825&Translate=false&tempauth=v1.eyJzaXRlaWQiOiJmOTZhZTQwOC0yOGFmLTQxYWQtODhhZC1kZGZmY2ZkYjc1ZmUiLCJhcHBfZGlzcGxheW5hbWUiOiJTUEUtQmFzZWJhbGwiLCJhcHBpZCI6ImZiN2NmNTIwLWNiMzMtNDViZi1hMjM4LWFlNTFkMzE2NjY1ZiIsImF1ZCI6IjAwMDAwMDAzLTAwMDAtMGZmMS1jZTAwLTAwMDAwMDAwMDAwMC9wdWNlbGlrZW50ZXJwcmlzZS5zaGFyZXBvaW50LmNvbUAxNTNhNmViZS1mZjYyLTRiY2UtYjFiYy1hMWVkYTNiYzY2NDUiLCJleHAiOiIxNzMxNjE3MDE3In0.CgoKBHNuaWQSAjY5EgsIzpKzp9W7wj0QBRoNMjAuMTkwLjEzNS40MioscW54cjFGalBneHh2N1lGTkp1dUpxTFZWdFFIS1hOQ2RlQ3EvUUk2aHhlcz0wuAE4AUIQoWPmC1YwAABF4iHcgCWrfkoQaGFzaGVkcHJvb2Z0b2tlbnIpMGguZnxtZW1iZXJzaGlwfDEwMDM3ZmZlOWE5NDg5ZGRAbGl2ZS5jb216ATKCARIJvm46FWL_zksRsbyh7aO8ZkWSAQVTdGV2ZZoBB1B1Y2VsaWuiASdzdGV2ZUBwdWNlbGlrZW50ZXJwcmlzZS5vbm1pY3Jvc29mdC5jb22qARAxMDAzN0ZGRTlBOTQ4OUREsgFyY29udGFpbmVyLnNlbGVjdGVkIGFsbGZpbGVzLnJlYWQgYWxsZmlsZXMud3JpdGUgY29udGFpbmVyLnNlbGVjdGVkIGFsbHNpdGVzLnJlYWQgYWxscHJvZmlsZXMucmVhZCBhbGxwcm9maWxlcy5yZWFkyAEB.tfaYgtjhQxMctJeHUWb9RU7CChHXqFHT0FaM9Dt7J9I&ApiVersion=2.1",
"createdDateTime": "2024-09-20T16:46:00Z",
"eTag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
"id": "01UELPCREJDUC3Q3UDRZF32K3WGS5MSKBF",
"lastModifiedDateTime": "2024-11-01T08:14:28Z",
"name": "ClaimExample-1.docx",
"size": 2299607,
"webUrl": "https://<tenant>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe/_layouts/15/Doc.aspx?sourcedoc=%7BB8051D89-836E-4B8E-BD2B-7634BAC92825%7D&file=ClaimExample-1.docx&action=default&mobileredirect=true",
"cTag": "\"c:{B8051D89-836E-4B8E-BD2B-7634BAC92825},5\"",
"commentSettings": {
"commentingDisabled": {
"isDisabled": false
}
},
"createdBy": {
"application": {
"displayName": "SPEContainerType",
"id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
},
"user": {
"displayName": "SharePoint App"
}
},
"lastModifiedBy": {
"application": {
"displayName": "SPEContainerType",
"id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
},
"user": {
"displayName": "Steve Pucelik",
"email": "Steve@<tenant>.onmicrosoft.com"
}
},
"parentReference": {
"driveId": "b!CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF",
"driveType": "other",
"id": "01UELPCRF6Y2GOVW7725BZO354PWSELRRZ",
"path": "/drives/b!CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF/root:",
"sharepointIds": {
"listId": "e6e197c4-4ab3-43a8-b402-5983507c6385",
"listItemUniqueId": "c4782251-bdd3-4766-a747-b2a2f51c3a00",
"siteId": "f96ae408-28af-41ad-88ad-ddffcfdb75fe",
"siteUrl": "https://<teannt>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe",
"tenantId": "153a6ebe-ff62-4bce-b1bc-a1eda3bc6645",
"webId": "2705c2f8-33aa-4a72-8438-25114dc3203b"
}
},
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
"quickXorHash": "DMzi0kCsuukcHlMXiPX9tmTCXtA="
}
},
"fileSystemInfo": {
"createdDateTime": "2024-09-20T16:46:00Z",
"lastModifiedDateTime": "2024-11-01T08:14:28Z"
},
"shared": {
"scope": "unknown"
},
"listItem@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF')/items('01UELPCREJDUC3Q3UDRZF32K3WGS5MSKBF')/listItem(fields())/$entity",
"listItem": {
"@odata.etag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
"createdDateTime": "2024-09-20T16:46:00Z",
"eTag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
"id": "23",
"lastModifiedDateTime": "2024-11-01T08:14:28Z",
"webUrl": "https://<tenant>.sharepoint.com/contentstorage/CSP_f96ae408-28af-41ad-88ad-ddffcfdb75fe/_layouts/15/Doc.aspx?sourcedoc=%7BB8051D89-836E-4B8E-BD2B-7634BAC92825%7D&file=ClaimExample-1.docx&action=default&mobileredirect=true",
"createdBy": {
"application": {
"displayName": "SPEContainerType",
"id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
},
"user": {
"displayName": "SharePoint App"
}
},
"lastModifiedBy": {
"application": {
"displayName": "SPEContainerType",
"id": "fb7cf520-cb33-45bf-a238-ae51d316665f"
},
"user": {
"displayName": "Steve Pucelik",
"email": "Steve@M<tenant>.onmicrosoft.com"
}
},
"parentReference": {
"id": "0",
"path": "Document Library",
"siteId": "f96ae408-28af-41ad-88ad-ddffcfdb75fe"
},
"contentType": {
"id": "0x0101004368E78BC3115C4CAD94FEA35E0F9D90",
"name": "Document"
},
"fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21CORq-a8orUGIrd3_z9t1_vjCBSeqM3JKhDglEU3DIDvEl-Hms0qoQ7QCWYNQfGOF')/items('01UELPCREJDUC3Q3UDRZF32K3WGS5MSKBF')/listItem/fields/$entity",
"fields": {
"@odata.etag": "\"{B8051D89-836E-4B8E-BD2B-7634BAC92825},21\"",
"id": "23",
"FileLeafRef": "ClaimExample-1.docx",
"<ColumnProperty>": "<Value>",
"ContentType": "Document",
"Created": "2024-09-20T16:46:00Z",
"AuthorLookupId": "1073741822",
"Modified": "2024-11-01T08:14:28Z",
"EditorLookupId": "7",
"_CheckinComment": "",
"LinkFilenameNoMenu": "ClaimExample-1.docx",
"LinkFilename": "ClaimExample-1.docx",
"DocIcon": "docx",
"FileSizeDisplay": "2299607",
"ItemChildCount": "0",
"FolderChildCount": "0",
"_ComplianceFlags": "",
"_ComplianceTag": "",
"_ComplianceTagWrittenTime": "",
"_ComplianceTagUserId": "",
"_CommentCount": "",
"_LikeCount": "",
"_DisplayName": "Confidential \\ Internal only",
"AppAuthorLookupId": "1",
"AppEditorLookupId": "1",
"Edit": "0",
"_UIVersionString": "19.0",
"MediaServiceImageTags@odata.type": "#Collection(microsoft.graph.Json)",
"MediaServiceImageTags": []
}
}
}
]
}
示例 2:按特定列属性枚举内容并按结果排序
此示例通过项上的列属性枚举指定的容器内容,并将按指定的列对结果进行排序:
请求
GET https://graph.microsoft.com/v1.0/drives/{{ContainerID}}/items?$filter=listitem/fields/{{ColumnProperty}} eq '{{Value}}'&$select=id,name,lastModifiedDateTime,size&$expand=listitem($expand=fields)&$orderby=createdDateTime desc
Headers:
Content-Type: application/json
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly
注意
当容器包含超过 5,000 个项,并且你正在将 enumerate 方法与 OrderBy 子句结合使用时,必须在请求的标头中包含以下内容。
Content-Type: application/json
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly
示例 3:按多个列属性枚举内容,并按结果排序
此示例通过指定的列属性枚举指定的容器内容,以及项目上的文档名称 (listitem/fields/FileLeafRef) ,并将按指定的列对结果进行排序:
请求
GET https://graph.microsoft.com/v1.0/drives/{{ContainerID}}/items?$filter=listitem/fields/{{ColumnProperty1}} eq '{{Value}}' AND listitem/fields/FileLeafRef eq '{{Value}}' &$select=id,name,lastModifiedDateTime,size&$expand=listitem($expand=fields)&$orderby=createdDateTime desc
Headers:
Content-Type: application/json
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly