"The expression is not valid" 执行 SharePoint Rest 调用时

"The expression is not valid" when performing SharePoint Rest call

我有一个 SharePoint 网站,当我调用

    SITE/_api/web/lists/  

它给我所有列表的数据没问题。问题是一旦我开始通过调用

查询特定列表(例如一个名为 "Environments" 的列表)
    SITE/_api/web/lists/getbytitle("Environments")/   

它给我错误

    Microsoft.SharePoint.Client.InvalidClientQueryExceptionThe expression "web/lists/getbytitle(Environments)/items" is not valid. 

我是不是 URL 构建不正确,还是网站有问题。

在列表标题两边使用撇号 (') 而不是引号。

如果您的列表图块的标题中有撇号,您需要通过将每个撇号替换为 %27%27 来转义它们。

正确的 REST URL 获取列表项是:

http://site url/_api/web/lists/GetByTitle('Test')/items

列表名称周围缺少单引号。

查看 MSDN:https://msdn.microsoft.com/en-us/library/office/dn292552.aspx