![](/img/trans.png)
[英]How to filter Sharepoint Terms in Microsoft Graph API?
[英]How to use filter in Microsoft Graph API to get SharePoint items?
在这里,我试图根据创建日期过滤数据。 一开始我在 Graph Explorer 中尝试过,它正在工作。
https://graph.microsoft.com/v1.0/me/messages?$filter=createdDateTime ge 2017-09-04&$select=subject,lastModifiedDateTime
现在尝试在戴尔 Boomi 中实现相同的功能。 这是拉取所有项目的资源路径: sites/{id}.sharepoint.com:/sites/{id}:/lists/{list_id}/items
它工作正常。
之后我添加过滤条件:
sites/{id}.sharepoint.com:/sites/{id}:/lists/{list_id}/items?$filter=lastModifiedDateTime ge 2017-09-04&$select=email,displayName
这是错误。 这是错误消息:
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
有人可以对此提供帮助,如何解决此问题? 这是示例数据。
> { "@odata.context":
> "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('1334af71-5b7a-4276-a8d8-c3f3f129051d')/items",
> "value": [
> {
> "@odata.etag": ""ef6e961c-a956-400e-a77d-f044d2e0b894,8"",
> "createdDateTime": "2018-05-24T13:38:10Z",
> "eTag": ""ef6e961c-a956-400e-a77d-f044d2e0b894,8"",
> "id": "3",
> "lastModifiedDateTime": "2018-06-18T10:24:27Z",
> "webUrl": "https://{id}.sharepoint.com/sites/{id}/Doc%20Interfaces/757391.pdf",
> "createdBy": {
> "user": {
> "email": "abc@abc.COM",
> "id": "173abc",
> "displayName": "abc"
> }
> },
> "lastModifiedBy": {
> "user": {
> "email": "xyz@abc.COM",
> "id": "234xyz",
> "displayName": "xyz"
> }
> },
> "parentReference": {
> "id": "03fe-16595a0da875"
> },
> "contentType": {
> "id": "0x01"
> },
> "fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('1334f71-c3f3f129')/items('3')/fields/$entity",
> "fields": {
> "@odata.etag": ""ef6e961-f044d2e0b894,8"",
> "FileLeafRef": "757391.pdf",
简答
使用自动生成的 SharePoint 列表项字段创建或修改
/items?expand=fields&$filter=fields/Modified gt '2018-01-01'
重要的提示
要对这些字段执行过滤查询,您必须:
说明
似乎不支持对图形端点返回的值(例如 lastModifiedDateTime、createdDateTime 等)进行过滤,因为/items&$filter=lastModifiedDateTime ge '2018-01-01' 之类的请求将返回“无效过滤器条款”错误。
我刚刚在向 Boomi 提交 OData 查询时解决了一个非常相似的问题。 问题是过滤字符串中的空格:
你的字符串: $filter=lastModifiedDateTime ge '2017-09-04' 应该是: $filter=lastModifiedDateTime%20ge%20'2017-09-04'
请尝试
sites/{id}.sharepoint.com:/sites/{id}:/lists/{list_id}/items?$filter=lastModifiedDateTime ge '2017-09-04'&$select=email,displayName
filter=lastModifiedDateTime ge '2017-09-04'
--> 单引号
注意:如果您选择任何查找值,您需要使用$expand
查询选项例如:
sites/{id}.sharepoint.com:/sites/{id}:/lists/{list_id}/items?$filter=lastModifiedDateTime ge '2017-09-04'&$select=email,displayName&$expand=displayName/Name
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.