0

I want a webpart that shows Events/Holidays based on the current user's location.

I'm using the Highlighted Content web part. I've filtered only on ContentType:Events and scope is on whole site.

How can I filter the events to only show events/holidays for the location by the current user (the person viewing the webpart)? The events have been tagged with different countries.

To get the current user name, there is attribute user.name. Is there anything similar to get the current user's location e.g. user.Location or user.Country?

1 Answer 1

0

Using graph api you can get current login user's office location and country details.

Based on it you can filter the holiday and event list in web part.

GET https://graph.microsoft.com/v1.0/me { "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity", "businessPhones": [ "+1 412 555 0109" ], "displayName": "Megan Bowen", "givenName": "Megan", "jobTitle": "Auditor", "mail": "[email protected]", "mobilePhone": null, "officeLocation": "12/1110", "preferredLanguage": "en-US", "surname": "Bowen", "userPrincipalName": "[email protected]", "id": "48d31887-5fad-4d73-a9f5-3c356e68a038" } GET https://graph.microsoft.com/beta/me { "@odata.context": "https://graph.microsoft.com/beta/$metadata#users/$entity", "id": "48d31887-5fad-4d73-a9f5-3c356e68a038", "deletedDateTime": null, "accountEnabled": true, "ageGroup": null, "businessPhones": [ "+1 412 555 0109" ], "city": "Pittsburgh", "createdDateTime": "2017-07-29T03:07:25Z", "creationType": null, "companyName": null, "consentProvidedForMinor": null, "country": "United States", "department": "Finance", "displayName": "Megan Bowen", "employeeId": null, "employeeHireDate": null, "employeeType": null, "faxNumber": null, "givenName": "Megan", .... } 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.