microsoft graph api批量请求不返回失败的对象id

2024-03-14

我有以下代码来发送批量请求以从 AAD 组中删除用户:

样品请求:

{方法:DELETE,RequestUri:'https://graph.microsoft.com/v1.0/groups/groupId/members/UserId/$ref',版本:1.1,内容:,标题: { }}

 private async Task<IAsyncEnumerable<RetryResponse>> SendBatch(BatchRequestContent tosend)
 {
       var response = await _graphServiceClient.Batch.Request().PostAsync(tosend);
       var responses = await response.GetResponsesAsync());
       foreach (var r in responses)
       {                
                using var res = r.Value;
                var status = res.StatusCode;
                var content = await res.Content.ReadAsStringAsync();
       }
}

如果在组中没有找到该用户,content具有以下值:

"{\r\n  \"error\": {\r\n    \"code\": \"Request_ResourceNotFound\",\r\n    \"message\": \"Resource '***groupId***' does not exist or one of its queried reference-property objects are not present.\",\r\n    \"innerError\": {\r\n      \"date\": \"2022-10-01T20:56:37\",\r\n      \"request-id\": \"fba27774-b542-4190-a6c8-83a857dcd7ec\",\r\n      \"client-request-id\": \"fba27774-b542-4190-a6c8-83a857dcd7ec\"\r\n    }\r\n  }\r\n}"

我注意到的是content包括组对象 ID,而不是用户对象 ID。 AAD 中存在组。我也确认了同样的情况。假设我批量发送了 10 个用户。其中5人失败了。有没有办法获取发生资源未找到错误的用户对象 ID 列表(本例中为 5)?


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

microsoft graph api批量请求不返回失败的对象id 的相关文章

随机推荐