cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

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

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 II
Super User II

@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.

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?


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.

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

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (43,950)