Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error information when paging using page Iterator #728

Closed
andrueastman opened this issue Sep 20, 2023 · 1 comment · Fixed by #761
Closed

Improve error information when paging using page Iterator #728

andrueastman opened this issue Sep 20, 2023 · 1 comment · Fixed by #761
Assignees
Labels
Bug Something isn't working

Comments

@andrueastman
Copy link
Member

andrueastman commented Sep 20, 2023

            var users = new List<User>();

            var response = await GraphServiceClient.Groups[groupId].TransitiveMembers
                .GraphUser
                .GetAsync(x => x.QueryParameters.Select = new[]
                    { "id", "displayName", "mail", "otherMails", "userPrincipalName", "accountEnabled", "proxyAddresses", "officeLocation" });
            var pageIterator = PageIterator<User, UserCollectionResponse>.CreatePageIterator(
                GraphServiceClient, response, (user) => { users.Add(user); return true; });
            await pageIterator.IterateAsync();

            return users;

The problem is that this happens only for one particular group (we use that code on multiple AADs and all works ok, except one particular group within one AAD). I know that the group has members, but I don't actually have access to authorize as the service principal and debug the code (this happens in production). So the problem is, I'm getting an error, but I don't know what it is about, beside it being http status 400.

I was hoping that this would give me the body of the response in the logs (i.e. when doing .ToString() on the ApiException), but looking at the code, it doesn't seem like it.

Originally posted by @macwier in microsoftgraph/msgraph-sdk-dotnet#2094 (comment)

@kpreddy89
Copy link

Hello,

I am still seeing this generic error message "Microsoft.Kiota.Abstractions.ApiException: The server returned an unexpected status code and no error factory is registered for this code: 400. The graph SDK nuget package version being used is 5.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants