Forum Discussion
Haniel Croitoru
Sep 29, 2016Learn Expert
Batch Update User Profile Properties
A few months back, the Patterns and Practices team at Microsoft announced a new User Profile Batch Update API. It's great for updating large batches of properties, but only works for user profile pr...
Pontus T
Jul 02, 2020Iron Contributor
Haniel Croitoru this reply is a couple of years late but your script is still relevant - thanks for sharing! After some slight adjustments to fit the new PnP cmdlets it works like a charm. However, I am running to an issue and I was hoping someone might have the answer.
One of the properties I am trying to update is the SPS-TimeZone, but it fails to accept the integer representing the SPS-TimeZone ID.
Setting the Time Zone separately works well, like this for example:
Set-PnPUserProfileProperty -Account $upn -Property 'SPS-TimeZone' -Value 10
But when I do this using the script, I get the following error:
Could not set SPS-TimeZone --> 3. Exception calling "Substring" with "2" argument(s): "Index and length must refer to a location within the string.
Parameter name: length"
And if I add it as a string, I get this:
Could not set SPS-TimeZone --> "45". Invalid time zone format. The value must be SPTimeZone object, a valid integer time zone ID, or a string representation of a valid integer time zone ID.
Thanks!
- Eric_MasesNov 01, 2021Brass Contributor
Yes, thanks for sharing, this post helped me a lot!
In the same spirit, I just want to add, that I experience no problem with setting SPS-TimeZone as long as I first setSet-PnPUserProfileProperty -Account $upn -PropertyName 'SPS-RegionalSettings-FollowWeb' -Value $false Set-PnPUserProfileProperty -Account $upn -PropertyName 'SPS-TimeZone' -Value '3'
List of TimeZone IDs are at https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/jj171282(v=office.15)