cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vermaaman
Frequent Visitor

get user location and set timezone of the site collection using flow!!

Greeting of the day,

 

I am fairly new with MS flow, please forgive me if my question sounds silly.

I have create a self service site provisioning engine using MS Flow, Azure function and pnp powershell, all working good.

 

at the moment i am passing the timezone of the user from a sharepoint configuration list by letting users select the location from a dropdown on the request form which is looked-up with a timezone id.

 

Problems Below:-

1- Business need user's location to come from user profie 'officelocation' property.
I tried using office 365 user connector but didn't get any success (may be an example will do) 😞

2- I have to set the site regional setting i.e. timezone based on user's location. is there any built in connector to achieve or any suggestion or example would be great?

Please show me some light on these issues.


Your help would be highly appreciated on this matter.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
vermaaman
Frequent Visitor

Re: get user location and set timezone of the site collection using flow!!

Thank you @edgonzales for the inputs, 

 

i was able to get the current user's location using Office365User.myprofile().city in powerapps and then converted the city name into timezone using pnpcmdlet (That i am running inside azure function) $Timezone = Get-PnPTimezoneId $Cityname >> $Id = $Timezone.Id and passed into my provisioning engine to apply required timezone on the site.

 

Thank you very much for the inputs

View solution in original post

5 REPLIES 5
Super User
Super User

Re: get user location and set timezone of the site collection using flow!!

@vermaaman 

Hi there!  So, I was surprised to see that the timezone didn't come over with the Get User Profile connector on O365.  Might be worth submitting an idea.

If you use PowerApps as your front end, then you can grab the user location from their mobile device pretty easily.  Not sure if that's an option.

Another thought is that since you're already doing PowerShell stuff, maybe there's a way to use the Get-TimeZone cmdlet and bring that back into Flow.

 

Keep us posted either way.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

vermaaman
Frequent Visitor

Re: get user location and set timezone of the site collection using flow!!

Thank you for the response, 

 

Get-TimeZone cmdlet works only on local machine where as i am running powershell inside azure function, so that option i have to eleminate unless one can prove me wrong on that. 

 

as for getting user's current location using mobo device may not be feasible at all times specially when user users powerapp only on computers. 

 

is there any other way in powerapps which can help us get that?


Super User
Super User

Re: get user location and set timezone of the site collection using flow!!

Ah, good to know.  I think PowerApps will grab whatever location data is available...so if there's no gps, it may 'guess' based on ip address or something.

 

I did see that Office Location and Postal Code come through.  That gives us a couple of options.  The easiest might be an API that translates zip codes to time zones.  This one looks promising...if that works, you can use the HTTP GET to grab the timezone and try that.

 

Another option might be to keep a SP list or a table that translates that for you.  Downside is populating/maintaining that data.

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

vermaaman
Frequent Visitor

Re: get user location and set timezone of the site collection using flow!!

Thank you @edgonzales for the inputs, 

 

i was able to get the current user's location using Office365User.myprofile().city in powerapps and then converted the city name into timezone using pnpcmdlet (That i am running inside azure function) $Timezone = Get-PnPTimezoneId $Cityname >> $Id = $Timezone.Id and passed into my provisioning engine to apply required timezone on the site.

 

Thank you very much for the inputs

View solution in original post

Highlighted
Super User
Super User

Re: get user location and set timezone of the site collection using flow!!

Awesome work!  I think you can mark your own post as the solution, so make sure you do that so others having the same trouble can benefit from your brain.  Robot Happy

 

-Ed-

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,252)