【发布时间】:2021-12-03 20:40:24
【问题描述】:
我有以下工作代码,列出了 Sharepoint 站点中的所有文件,并获取了它们的 driveItem 详细信息:
var directoryContents = await App.GraphClient.Sites[SiteIdShortName].Lists[sharedDocsDriveId]
.Items
.Request()
.Expand(item => item.DriveItem)
.GetAsync();
SharedDocumentList.ItemsSource = directoryContents.CurrentPage.ToList();
除了上述查询已经获取的数据之外,现在我还需要一种方法来获取每个项目的发布状态。我在 stackoverflow 上找到了这篇文章:
checkout status of a onedrive file using microsoft graph api
所以我尝试将我的代码更改为如下所示:
var directoryContents = await App.GraphClient.Sites[SiteIdShortName].Lists[sharedDocsDriveId]
.Items
.Request()
.Expand(item => item.DriveItem)
.Select(item => item.DriveItem.Publication)
.GetAsync();
SharedDocumentList.ItemsSource = directoryContents.CurrentPage.ToList();
但我收到以下错误消息:
Message=lambda 表达式中的匿名类型只能被初始化 具有 ListItem 类型的直接成员参数名称:selectExpression 来源=Microsoft.Graph
编辑 1
我也试过这个:
var queryOptions = new List<QueryOption>()
{
new QueryOption("select", "publication")
};
var directoryContents = await App.GraphClient.Sites[SiteIdShortName].Lists[sharedDocsDriveId]
.Items
.Request(queryOptions)
.Expand(item => item.DriveItem)
.GetAsync();
SharedDocumentList.ItemsSource = directoryContents.CurrentPage.ToList();
但我得到的错误是:
内部异常 1:JsonReaderException: '{' 在值之后无效。 应为“,”、“}”或“]”。行号:0 |字节位置线: 223.
【问题讨论】:
标签: c# sharepoint microsoft-graph-api xamarin.uwp