【发布时间】:2019-01-25 23:12:22
【问题描述】:
通过我的 Office 365 帐户在 SharePoint Online 网站中,我在我的文档中添加了一个列 - “CustomerId”。我想在 C#(不是 JavaScript)中查找 CustomerId 为 102 的所有文档。
到目前为止,我能够获取文件夹下的所有文件
var files = graphClient.Sites[siteId].Drive.Items[driveItemId]
.Children.Request().GetAsync().Result;
或者在 Graph Explorer 中查看相同的结果 https://graph.microsoft.com/v1.0/sites/{siteId}/drive/items/{driveItemId}/children
但我还没有找到正确的语法来使用 C# 或图形资源管理器中的自定义列过滤条件获取所有文档 (driveIems)。我尝试过的事情的例子:
在 C# 中
var files = graphClient.Sites[siteId].Drive.Items[driveItemId]
.Search("fields/CustomerId eq 102").Request().GetAsync().Result;
希望有人能帮我解决这个问题。
更新:
以前我从
var customerFolder = graphClient.Sites[siteId].Drive.Root
.ItemWithPath("CustomerGroup/IndustryGroup").Request().GetAsync().Result;
string driveItemId = customerFolder.Id;
我知道我可以得到一个 ListItem
var customerFolder = graphClient.Sites[siteId].Drive.Root
.ItemWithPath("CustomerGroup/IndustryGroup").Request()
.Expand(d => d.ListItem).GetAsync().Result;
但我只从 customerFolder.ListItem.Id 中找到了“4”的列表 ID
如何获取列表 ID 以便在 graphClient.Sites[siteId].Lists[listId] 中使用它?
【问题讨论】:
标签: c# rest api microsoft-graph-api sharepoint-online