It’s pretty easy now to get your Office 365 tenant ID. Here, I will demonstrate three ways, by which you can retrieve your tenant ID :-
- Azure portal (new and old)
- PowerShell
- SharePoint Online
It’s pretty easy now to get your Office 365 tenant ID. Here, I will demonstrate three ways, by which you can retrieve your tenant ID :-
This is the final of the two-series blog. Before proceeding further, here’s the link to the 1st part, https://realmpksharepoint.wordpress.com/2015/06/19/export-sharepoint-metadata-to-csv-along-with-their-guids/. The objectivity of the entire series has been already defined there so I won’t be re-iterating the same. However, I must re-visit some of the items relevant to the current context. So following are the objectives of this script:
There are three parameters that needs to be set before executing the script. They are:
This is a two series blog in which I will try to cover lots of SharePoint TermSet Metadata operations. The idea is to achieve the following:
In this post, I’ll only be showing the export operation. The import operation has been defined here, https://realmpksharepoint.wordpress.com/2015/09/23/import-sharepoint-metadata-from-csv-along-with-their-guids-deprecate-state-and-custom-ordering/. Please note that since the generated output will be in CSV format, we’re converting any comma (,) that might be included in the Term name to “,” otherwise the format will get distorted.
The script expects two parameters that needs to be set before executing it. They are:
Here’s the script preview. Download link for the same has been provided in the later segment.
I had this requirement where there was a need to rename some of the existing Managed MetaData Terms, [Old Parent, Old1, Old2, & Old3] to a single new Term [New Term].
Usually, renaming a single term is no big deal. However, this was a Many => One relationship and you cannot have 2 or more Terms with identical names at the same level of hierarchy. So renaming was not an option here. We had to make sure that for all the existing ListItems, the GUIDs of every old term should get replaced with the New Term GUID. Following is the PowerShell script I came up with to do this job.
Read More »
We’re gonna use, Microsoft.Office.Server.UserProfiles.UserProfileManager class to get a given Microsoft.Office.Server.UserProfiles.UserProfile and update some of its values. Say, there are two custom properties defined in the SharePoint Central Admin which are mapped to some TermStores. They are:
Our objective is to update these metadata fields using a powerShell script. Before we delve into that, there are few things that needs to be clarified here.
So here’s the script snippet.
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") #Get any site $site = Get-SPSite -Limit 1 $context = Get-SPServiceContext($site) $profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) $userProfile = $profileManager.GetUserProfile("domain\UserName") #Some default properties can be accessed using the dot operator. Write-Host ("Changing custom properties for " + $userProfile.DisplayName) #valid region value $userProfile["CpSingle"].Value = "Asia" #First clear any existing item for multi property. Then add our values. $userProfile["CpMulti"].Clear() $userProfile["CpMulti"].Add("India") $userProfile["CpMulti"].Add("Bhutan") $userProfile["CpMulti"].Add("Sri Lanka") #Finally save all the changes. $userProfile.Commit()
This script is good for modifying the custom metadata properties of a single user. But if we want to make these changes or some other changes uniform to all the existing UserProfiles, then we need to enumerate through all the userProfiles instead of fetching a single value. Same script to update the above mentioned custom properties with the same value for all the UserProfiles is mentioned below.
$profiles = $profileManager.GetEnumerator() while ($profiles.MoveNext()) { #Get the current profile $userProfile = $profiles.Current Write-Host ("Changing custom properties for " + $userProfile.DisplayName) #valid region value $userProfile["CpSingle"].Value = "Asia" #First clear any existing item. Then add our values. $userProfile["CpMulti"].Clear() $userProfile["CpMulti"].Add("India") $userProfile["CpMulti"].Add("Bhutan") $userProfile["CpMulti"].Add("Sri Lanka") #Finally save all the changes. $userProfile.Commit() }