Microsoft Grapi API SDK Sharepoint 列表

Microsoft Grapi API SDK Sharepoint LIst

我只是想过滤一个简单的测试共享点列表。每次我 运行 下面的代码都会收到无效的过滤器子句错误。我已经尝试了所有我能找到的 combination/syntax。任何建议都会有所帮助。完成后,我希望能够根据修改日期进行过滤。基本上带回两个日期时间之间的所有记录。

GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var queryOptions = new List<QueryOption>()
{
  new QueryOption("expand","fields")
 ,new QueryOption("$filter","fields/Field 1 eq 'Field 1 value'")
};
var aa = await graphClient.Sites["{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}"].Lists[sharepointlistid].Items.Request(queryOptions).GetAsync();

根据我的测试,以下内容适合我。请确保您在过滤器中使用字段的内部名称。

        var queryOptions = new List<QueryOption>()
            {
                new QueryOption("$expand","fields"),
            new QueryOption("$filter","fields/Title eq 'testValue'")
            };

        var items = await graphClient
            .Sites["{site-id}"]
            .Lists["{list-id}"]
            .Items
            .Request(queryOptions)
            .Header("Prefer", "HonorNonIndexedQueriesWarningMayFailRandomly")
            .GetAsync()