Microsoft Graph API 分页 Users.NextPageRequest.GetAsync() return 错误消息下一页搜索请求无效
Microsoft Graph API Pagination Users.NextPageRequest.GetAsync() return error with message Invalid next page search request
我试图从下一页拉取 B2C 用户,但出现以下错误:
代码:Request_UnsupportedQuery
消息:无效的下一页搜索请求。
内部错误:
附加数据:
日期:2021-07-08T20:25:20
请求 ID:7fd74717-0f7b-467f-9753-64c416fe5902
客户端请求 ID:7fd74717-0f7b-467f-9753-64c416fe5902
ClientRequestId:7fd74717-0f7b-467f-9753-64c416fe5902
问题是我使用相同的代码来获取 AAD 用户并且它有效,但不知何故不适用于 B2C 用户!!
这是我正在使用的代码:
//read B2C
ClientCredentialProvider authProviderB2C = new(this.B2CClientApp);
// Create a new instance of GraphServiceClient in B2C with the authentication provider.
GraphServiceClient graphClientB2C = new(authProviderB2C);
var b2cUsers = await graphClientB2C.Users
.Request()
.Filter($"identities/any(c:c/issuer eq '{AppSettingsProvider.AADIssuer}')")
.Top(999)
.Select(u => new {
u.DisplayName,
u.Id,
u.Mail,
u.UserPrincipalName,
u.Identities
})
.GetAsync();
// Create a bucket to hold the final B2C users result
var b2cUserList = new List<User>();
// Add the first page of data to the final B2C user list
b2cUserList.AddRange(b2cUsers.CurrentPage);
// Repeate until all pages have been returned
while (b2cUsers.NextPageRequest != null)
{
b2cUsers = await b2cUsers.NextPageRequest.GetAsync();
b2cUserList.AddRange(b2cUsers.CurrentPage);
}
调用 b2cUsers = await 时出现上述错误 b2cUsers.NextPageRequest.GetAsync();
非常感谢任何帮助。谢谢。
问题是具有身份的过滤器不支持分页,即使 NextPageRequest 存在并且 != null。
我试图从下一页拉取 B2C 用户,但出现以下错误: 代码:Request_UnsupportedQuery 消息:无效的下一页搜索请求。 内部错误: 附加数据: 日期:2021-07-08T20:25:20 请求 ID:7fd74717-0f7b-467f-9753-64c416fe5902 客户端请求 ID:7fd74717-0f7b-467f-9753-64c416fe5902 ClientRequestId:7fd74717-0f7b-467f-9753-64c416fe5902
问题是我使用相同的代码来获取 AAD 用户并且它有效,但不知何故不适用于 B2C 用户!! 这是我正在使用的代码:
//read B2C
ClientCredentialProvider authProviderB2C = new(this.B2CClientApp);
// Create a new instance of GraphServiceClient in B2C with the authentication provider.
GraphServiceClient graphClientB2C = new(authProviderB2C);
var b2cUsers = await graphClientB2C.Users
.Request()
.Filter($"identities/any(c:c/issuer eq '{AppSettingsProvider.AADIssuer}')")
.Top(999)
.Select(u => new {
u.DisplayName,
u.Id,
u.Mail,
u.UserPrincipalName,
u.Identities
})
.GetAsync();
// Create a bucket to hold the final B2C users result
var b2cUserList = new List<User>();
// Add the first page of data to the final B2C user list
b2cUserList.AddRange(b2cUsers.CurrentPage);
// Repeate until all pages have been returned
while (b2cUsers.NextPageRequest != null)
{
b2cUsers = await b2cUsers.NextPageRequest.GetAsync();
b2cUserList.AddRange(b2cUsers.CurrentPage);
}
调用 b2cUsers = await 时出现上述错误 b2cUsers.NextPageRequest.GetAsync();
非常感谢任何帮助。谢谢。
问题是具有身份的过滤器不支持分页,即使 NextPageRequest 存在并且 != null。