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

API to get mailboxsettings #57

Closed
madanbisht opened this issue Oct 6, 2020 · 7 comments
Closed

API to get mailboxsettings #57

madanbisht opened this issue Oct 6, 2020 · 7 comments
Labels
question Further information is requested

Comments

@madanbisht
Copy link

Hi David, Good Morning...!!!
We are trying to get mailboxsettings using odata but didn't find any API and below is the corresponding graph API. Is it possible to add?

https://graph.microsoft.com/v1.0/users/{user}/mailboxsettings

@davidmoten
Copy link
Owner

Peculiar, I'll check it out...

@davidmoten
Copy link
Owner

It's there:

client.users("123").get().getMailboxSettings();

@davidmoten
Copy link
Owner

BTW latest version is 0.1.41

@davidmoten
Copy link
Owner

Ah, I think I see a bug. If I do this:

GraphService client = MsGraph.explorer().build();
System.out.println(client.me().get().getMailboxSettings());

I get

Optional.empty

but if I do:

GraphService client = MsGraph.explorer().build();
System.out.println(client.me().select("mailboxSettings").get().getMailboxSettings());

I get

Optional[MailboxSettings[archiveFolder=AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAFNAAA=, automaticRepliesSetting=AutomaticRepliesSetting[externalAudience=ALL, externalReplyMessage=, internalReplyMessage=, scheduledEndDateTime=DateTimeTimeZone[dateTime=2020-10-07T07:00:00.0000000, timeZone=UTC],unmappedFields={},odataType=null, scheduledStartDateTime=DateTimeTimeZone[dateTime=2020-10-06T07:00:00.0000000, timeZone=UTC],unmappedFields={},odataType=null, status=DISABLED],unmappedFields={},odataType=null, dateFormat=M/d/yyyy, delegateMeetingMessageDeliveryOptions=SEND_TO_DELEGATE_ONLY, language=LocaleInfo[displayName=English (United States), locale=en-US],unmappedFields={},odataType=null, timeFormat=h:mm tt, timeZone=Pacific Standard Time, workingHours=WorkingHours[daysOfWeek=[MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY], endTime=17:00, startTime=08:00, timeZone=TimeZoneBase[name=Pacific Standard Time],unmappedFields={},odataType=null],unmappedFields={},odataType=null],unmappedFields={},odataType=null]

I'll chase it down.

@davidmoten
Copy link
Owner

So odata-client-msgraph is behaving itself but according to the OData spec you should just be able to call client.me().mailboxSettings().get(). I'll have a look at that in a bit. First I'll try and find out how the user should know when to add .select("X") to get the expanded property.

@davidmoten
Copy link
Owner

Ah, it's not a bug, this is expected behaviour.

From https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http:

Note: Getting a user returns a default set of properties only (businessPhones, displayName, givenName, id, jobTitle, mail, mobilePhone, officeLocation, preferredLanguage, surname, userPrincipalName). Use $select to get the other properties and relationships for the user object.

@davidmoten davidmoten added the question Further information is requested label Oct 6, 2020
@madanbisht
Copy link
Author

madanbisht commented Oct 6, 2020

Thanks for the quick response below works fine.

                        graphObject()
                            .users(mailid)
                            .select("mailboxSettings")
                            .get()
                            .getMailboxSettings());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants