OData Sharepoint Rest API过滤器

时间:2019-12-21 11:05:32

标签: odata sharepoint-rest-api

我正在尝试在共享点列表中检索文件夹名称为

的文件夹

https://**.sharepoint.com/_api/Web/GetFolderByServerRelativePath(decodedurl ='/ Salesforce')/ Folders?$ filter =名称以“ abc”开头

错误

  

{       “错误”:{           “ code”:“ -1,Microsoft.SharePoint.Client.InvalidClientQueryException”,           “信息”: {               “ lang”:“ en-US”,               “ value”:“表达式\”名称以'abc'\开头”无效。           }       }

https://**.sharepoint.com/_api/Web/GetFolderByServerRelativePath(decodedurl ='/ Salesforce')/ Folders?$ select = Name $ filter = contains(Name,'abc')

  

{       “错误”:{           “ code”:“ -1,Microsoft.SharePoint.Client.InvalidClientQueryException”,           “信息”: {               “ lang”:“ en-US”,               “ value”:“表达式\” Name $ filter = contains(Name,'abc')\“无效。           }       }

请指导。

抱歉,必须添加&

https://****.sharepoint.com/_api/Web/GetFolderByServerRelativePath(decodedurl ='/ Salesforce')/ Folders?$ select = Name&$ filter =((startswith(name,'test')) )

现在它正在返回所有文件夹。不是以测试开始的人

1 个答案:

答案 0 :(得分:0)

“ startwith”过滤器具有以下格式:

$filter=startswith(FieldName, 'abc')

如果您需要使用“包含”过滤器,则必须使用以下格式:

$filter=substringof(FieldName, 'abc')

本文(https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90))对于从OData URI中的过滤器表达式开始很有帮助。