Microsoft Graph API - 如何使用“skiptoken”

问题描述 投票:0回答:2

它正在向某些团队的频道ID带来消息和回复。

用这个,

https://graph.microsoft.com/beta/teams/{teamId}/channels/{channelId}/messages/{messageId}/replies?$top=50

如果我们得到超过 50 个结果,它会返回 @odata.nextLink contains 'skiptoken'

像这样..

https://graph.microsoft.com/beta/teams/{teamId}/channels/{channelId}/messages/{messageId}/replies?$top=50&$skiptoken=ABCDEFG1234

但是我想做的是在 C# 代码中使用“skiptoken”。

我试过了,

 var replies = await graphClient.Teams[teamId].Channels[channel.Id].Messages[chatId].Replies
           .Request()
           .Top(50)
           .Skiptoken(skiptoken)
           .GetAsync();

此代码返回错误。

  • IChatMessageRepliesCollectionRequest 不包含“skiptoken”的定义。

如何使用“skiptoken”?请帮我。 谢谢。

c# microsoft-graph-api microsoft-teams
2个回答
1
投票

您可以使用以下代码。

var queryOptions = new List<QueryOption>() 
{ 
new QueryOption("$skiptoken", "MSwwLDE1OTgwMzU4MTE4OTQ") 
}; 
var replies = await graphClient.Teams["d3b31e36-d63d-4bbe-9478-b4cc7cb17a3d"].Channels["19:[email protected]"].Messages["1598032654892"].Replies 
.Request(queryOptions) 
.GetAsync();

0
投票

你可以使用

等待 graphClient.Teams[teamId].Channels[channel.Id].Messages[chatId].Replies.WithUrl(OdataNextLink).Request().GetAsync()

© www.soinside.com 2019 - 2024. All rights reserved.