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

[Client bug]: No way to update MailboxSettings in v5 #1712

Closed
MartinM85 opened this issue Mar 12, 2023 · 1 comment · Fixed by microsoftgraph/msgraph-metadata#324
Closed

Comments

@MartinM85
Copy link
Contributor

Describe the bug
According to the documentation the endpoint to update mailbox settings is

PATCH /me/mailboxSettings
PATCH /users/{id|userPrincipalName}/mailboxSettings

But SDK v5 doesn't have any MailboxSettings property on either UserItemRequestBuilder or MeRequestBuilder

To Reproduce
Steps to reproduce the behavior:

  1. Type either graphClient.Me.MailboxSettings or graphClient.Users[""].MailboxSettings

Expected behavior
Can access MailboxSettings property on either UserItemRequestBuilder or MeRequestBuilder

Screenshots
If applicable, add screenshots to help explain your problem.

Client version
5.1.0.0

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@ghost ghost added the Needs: Triage label Mar 12, 2023
@andrueastman
Copy link
Member

Thanks for raising this @MartinM85

Hi @SomebodyToLove1337,

Unfortunately, structural properties that can be accessed through the URI are not accessible through the SDK at the moment and should be resolved in future metadata updates.
You can however workaround this by using the request builders as below.

            var mailboxSettings = new MailboxSettings
            {
                AutomaticRepliesSetting = new AutomaticRepliesSetting
                {
                    ScheduledStartDateTime = new DateTimeTimeZone(),
                    ScheduledEndDateTime = new DateTimeTimeZone()
                }
            };
            var requestInformation = graphServiceClient.Users["{o365UserID}"].ToGetRequestInformation();
            requestInformation.HttpMethod = Method.PATCH;
            requestInformation.UrlTemplate = "{+baseurl}/users/{user%2Did}/mailboxSettings";//update the template to include /mailBoxSettings
            requestInformation.SetContentFromParsable<MailboxSettings>(graphServiceClient.RequestAdapter, "application/json", mailboxSettings);

            await graphServiceClient.RequestAdapter.SendNoContentAsync(requestInformation);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants