msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

GraphClient SDK always returns null MailboxSettings

Open kisnam opened this issue 8 years ago • 2 comments

Hi,

I am having an issue getting timezone value from MailBoxSettings with Graph SDK. I am able to get timezone when using the REST api here, https://graph.microsoft.com/v1.0/me/mailboxSettings/timeZone

However GraphClient SDK(Microsoft.Graph Nuget Package) does not load MailBoxSettings and it is always null. I was testing the graph console app, https://github.com/microsoftgraph/console-csharp-connect-sample

            var graphClient = AuthenticationHelper.GetAuthenticatedClient();
            var me = graphClient.Me.Request().GetAsync().Result;
            var timeZone = me.MailboxSettings.TimeZone;

Appreciate your help.

kisnam avatar Oct 31 '18 10:10 kisnam

MailboxSettings is a property of the User object that is not returned by default. In order to retrieve it you have to explicitly select it. There is a StackOverflow question that shows how here You will also need the permission MailboxSettings.Read

darrelmiller avatar Oct 31 '18 14:10 darrelmiller

That worked! Thanks for the reference.

kisnam avatar Nov 02 '18 07:11 kisnam