cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vermaaman
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 103 members 5,464 guests
Please welcome our newest community members: