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

Support User.MailboxSettings with only MailboxSettings.Read #538

Closed
matt-sullivan opened this issue Sep 4, 2019 · 6 comments
Closed

Support User.MailboxSettings with only MailboxSettings.Read #538

matt-sullivan opened this issue Sep 4, 2019 · 6 comments

Comments

@matt-sullivan
Copy link

matt-sullivan commented Sep 4, 2019

There is currently no .Net way to read users' MailboxSettings with only (Application) MailboxSettings.Read permissions.

client.Users[id].Request().Select("MailboxSettings").GetAsync()
calls https://graph.microsoft.com/v1.0/users/xxx?$select=mailboxSettings
and gets an access denied error. This seems like a bug in the graph service, but I'm not sure of that and not sure where to report it.

It is possible to query https://graph.microsoft.com/v1.0/users/xxx/mailboxSettings with only those permissions, however I don't think this library has any way to query that url.

Should a MailboxSettings property be added to IUserRequestBuilder?

https://stackoverflow.com/questions/54750940/access-denied-when-trying-to-get-my-mailboxsettings-using-select-with-mailboxset relates to this issue.
AB#7299

@ghost ghost added the Needs: Triage label Sep 4, 2019
@ghost ghost added this to Issues to triage in Graph SDK - Triage Sep 4, 2019
@MIchaelMainer
Copy link
Contributor

Marked your initial concern as a service issue which we will discuss with service owner a bit later today.

We are aware that our generated library doesn't provide navigation to the mailboxsettings resource. We have plans to provide a generic way to address this issue. Adding a partial for IUserRequestBuilder for Mailboxsettings would provide the functionality to access MailboxSettings. That would require a few other files as well.

@MIchaelMainer MIchaelMainer removed this from Issues to triage in Graph SDK - Triage Sep 10, 2019
@MIchaelMainer MIchaelMainer added this to To do in Graph SDK Generator via automation Sep 10, 2019
@MrTantum
Copy link

MrTantum commented Sep 19, 2019

Please also add a possibility to only load specific properties of the mailbox settings. E.g. by directly using the endpoint for the mailboxsettings language:

GET https://graph.microsoft.com/v1.0/me/mailboxSettings/language

as described here.

@pschaeflein
Copy link
Contributor

@matt-sullivan As an interim measure, the UserSettings resource has been added to the community library.

https://github.com/microsoftgraph/msgraph-sdk-dotnet-contrib/blob/master/test/UserMailboxSettingsRequestTests.cs

@MIchaelMainer
Copy link
Contributor

MIchaelMainer commented Jan 28, 2020

Here's how you can use the SDK in its current state to get mailboxsettings.

async Task GetMailboxSettings(GraphServiceClient client)
{
	var mailboxSettingsUrl = client.Users["adelev@contoso.onmicrosoft.com"].RequestUrl + "/mailboxsettings";
	HttpRequestMessage hrm = new HttpRequestMessage(HttpMethod.Get, mailboxSettingsUrl);
	
	await client.AuthenticationProvider.AuthenticateRequestAsync(hrm);
	
	HttpResponseMessage response = await client.HttpProvider.SendAsync(hrm);

	if (response.IsSuccessStatusCode)
	{
		// Deserialize into MailboxSettings object.
		var content = await response.Content.ReadAsStringAsync();
		MailboxSettings mailboxSettings = client.HttpProvider.Serializer.DeserializeObject<MailboxSettings>(content);
	}
}

You can append individual settings to the end of mailboxSettingsUrl. You will need to change the deserializaton target.

@LeightonSean
Copy link

I've been following this thread because I was experiencing the same issue but today I discovered it is working and I can get the MailboxSettings with just MailboxSettings.Read. Was there any update that resolved this?

@ddyett ddyett added the promote label Jan 11, 2021
@andrueastman
Copy link
Member

This was fixed silently on the API side. Closing this as it is now resolved.

Graph SDK Generator automation moved this from To do to Done May 12, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

7 participants