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

$select clause not respected while retrieving users mailbox settings with batch request #2511

Closed
felpel opened this issue May 22, 2024 · 3 comments
Labels
Question: API Status: No recent activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:bug A broken experience

Comments

@felpel
Copy link

felpel commented May 22, 2024

Describe the bug

  1. Have a list of user IDs
  2. For each ID, create a batch request step to retrieve mailbox settings and apply a $select filter (e.g. timeZone)
  3. Send the batch request to the Graph API
  4. On success, iterate on all responses by status codes, then find all responses with 200 OK as their status
  5. Inspect the payload of the returned response 👉 all mailbox settings properties will be returned.

Expected behavior

The $select clause shall be fulfilled and return only the requested fields.

How to reproduce

string[] selectedFields = { "timeZone" }; // This can be any combination of fields, doesn't matter 
List<string> userIds = ... // Some list provided as an input
CancellationToken cancellationToken = ... // Also provided as an input
GraphServiceClient client = ... // Instantiate your client with appropriate app permissions
var batch = new BatchRequestContentCollection(client);

foreach (var userId in userIds) 
{
     await batch.AddBatchRequestStepAsync(
                    client
                        .Users[userId]
                        .MailboxSettings
                        .ToGetRequestInformation(rc =>
                        {
                            rc.QueryParameters.Select = selectedFields;
                        }));
}

// 👇 this call will return all fields per response object
await client.Batch.PostAsync(batch, cancellationToken);

SDK Version

5.49.0

Latest version known to work for scenario above?

No response

Known Workarounds

We may continue fetching all fields, but it is undesirable.

Debug output

N/A

Configuration

  • OS: Windows 11
  • Arch: N/A

Other information

No response

@felpel felpel added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels May 22, 2024
@felpel felpel changed the title $select clause not respect while retrieving users mailbox settings with batch request $select clause not respected while retrieving users mailbox settings with batch request May 22, 2024
@MartinM85
Copy link
Contributor

Seems like server related issue. The similar query in the Graph Explorer returns all properties

GET https://graph.microsoft.com/v1.0/me/mailboxSettings?$select=timeZone

@andrueastman andrueastman added Question: API and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels May 23, 2024
@andrueastman
Copy link
Member

Thanks for confirming @MartinM85

@felpel Would you be willing to submit feedback for the Api team with regards to this at the link below? As this issue isn't SDK related, we may not best placed to resolve this.

https://aka.ms/graphfeedback

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question: API Status: No recent activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

3 participants