Skip to content
  • Home
  • About
Search
Close

Piyush K Singh

unfolding the journey

Tag: TermStore

SharePoint QuickLaunch Automation

Generate Modern List Filter URL: Managed Metadata

May 24, 2019June 3, 2019 Piyush K Singh3 Comments

Premise

We had this requirement where we needed to create ~100 (parent/child)
QuickLaunch links pointing to a single modern SharePoint list. These links will be filtered view on the same list based on the selection. We knew, that in modern SharePoint, instead of creating 100 different views, we can simply filter a list using specified query string parameters. The issue in hand were, how to:

  • Generate the URLs on Managed Metadata (Termstore) field for QuickLaunch
  • Automate the QuickLaunch creation process
Read More »

Import SharePoint MetaData from CSV along with their Guids, Deprecate-State and Custom Ordering

September 23, 2015December 11, 2016 Piyush K Singh2 Comments

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:

  • Import Terms to SharePoint only when they don’t already exist. The search will be done using the Term Name only.
  • Can create a Term with the given Guid i.e., Guids can be retained across the servers. This is optional. If you don’t want to use this option, then keep this column blank and the TermSet will be created using a brand new Guid assigned by the SP.
  • Deprecate/Un-Deprecate an existing or a new Term. If you want to change this option on a number of pre-existing TermSets or you even want to create the TermSets with the deprecate value on, then simply update the corresponding column in the exported CSV and then run the import script.
  • Modify the availability for Tagging option. If you have to change this option on a number of pre-existing or new TermSets then simply update the given CSV accordingly and then run the import script.
  • Most importantly, it applies custom sorting to the TermSets. So the TermSet and their child terms will exactly appear in the same order as has been listed in the processing CSV file.

Input

There are three parameters that needs to be set before executing the script. They are:

  • $fileName: Full path of the csv file to be imported.
  • $termStoreGroupName: Term group name. Please note that the script does not create a term group. Hence do ensure first that the group already exist at SharePoint even if its blank.
  • $MMSStore: Name of the managed metadata service.

Read More »

Export SharePoint MetaData to CSV along with their Guids

June 19, 2015December 11, 2016 Piyush K Singh4 Comments

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:

Export Terms to CSV

  • Existing Terms along with their child Terms,
  • Current Guid,
  • Available for Tagging option, &
  • Deprecate state.

Import Terms from CSV

  • Import Terms which will create Terms only when they don’t already exist. The search will be done using the Term Name.
  • Can create the Term with the given Guid. This is optional. If you don’t want to use this option, then keep this column blank and the Term will be created using a brand new Guid.
  • Deprecate/Un-Deprecate an existing or a new Term. If you have to change this option on a number of pre-existing TermSets then simply update the exported CSV accordingly and then run the import script.
  • Modify the availability for Tagging option. If you have to change this option on a number of pre-existing TermSets then simply update the given CSV accordingly and then run the import script.
  • Most importantly, it also applies custom sorting. So the Terms and their child terms will exactly appear in the same order as has been mentioned in the processing CSV.

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.

Input

The script expects two parameters that needs to be set before executing it. They are:

  • $termGrpNm: The name of the TermGroup whose all TermSets will be exported to CSV files respectively.
  • $svLoc: File System location where all the CSVs will be dumped.

Here’s the script preview. Download link for the same has been provided in the later segment.

Read More »

Changing the value of Existing ListItems Old Managed MetaData Value with a New One

May 10, 2015December 11, 2016 Piyush K SinghLeave a comment

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 »

Update Custom MetaData Property in SharePoint UserProfile

March 5, 2015April 3, 2016 Piyush K SinghLeave a comment

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:

  1. CpSingle [Single metaData value is allowed. Mapped to say Continent/Region].
  2. CpMulti [This metaData field can have multiple values. Mapped to say Countries.].

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.

  • Indexing a userProfile object, say, $userProfile[“CpSingle”], will return an object of Microsoft.Office.Server.UserProfiles.UserProfileValueCollection.
  • So we can add multiple values to this object using its Add(Object o) function.
  • Similarly, existing items can be removed by calling its Clear() function.
  • If only a single property has to be set then, we can use it’s Value property to do the same. It gets or sets the value of the profile property.

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()
}
Piyush K Singh

Piyush K Singh

Cloud consultant. Microsoft 365

View Full Profile →

Top Posts

  • PowerApps: Edit and Submit Form
  • Power Automate: Read Excel File
  • PowerApps: Pass argument to another screen
  • Register App in SharePoint
  • Update the child flow for action 'Run_a_Child_Flow' to not use 'run-only user' connections.

Recent Posts

  • Temporarily disable Power Automate Trigger
  • Update the child flow for action ‘Run_a_Child_Flow’ to not use ‘run-only user’ connections.
  • SharePoint Online: Get User Profile Properties
  • Fatal: no email was given and auto-detection is disabled
  • Power Automate: Copy SharePoint List Attachments

Categories

Microsoft Flow Microsoft PowerApps Power Automate SharePoint SharePoint Apps SharePoint Online SharePoint Online List SharePoint Online List Field SharePoint Online ListItem SharePoint WebPart

#Twitter

My Tweets

Recent Posts

  • Temporarily disable Power Automate Trigger
  • Update the child flow for action ‘Run_a_Child_Flow’ to not use ‘run-only user’ connections.
  • SharePoint Online: Get User Profile Properties
  • Fatal: no email was given and auto-detection is disabled
  • Power Automate: Copy SharePoint List Attachments

Recent Comments

enguerran on Power Automate: Read Excel…
Juni on Power Automate: Copy SharePoin…
Harry Chang on PowerApps: Pass argument to an…
Siddhesh on Power Automate: Read Excel…
shannon on PowerApps: Edit and Submit…

Archives

  • May 2021
  • March 2021
  • January 2021
  • July 2020
  • May 2020
  • February 2020
  • December 2019
  • October 2019
  • September 2019
  • July 2019
  • May 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • August 2017
  • July 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • August 2016
  • July 2016
  • June 2016
  • April 2016
  • March 2016
  • February 2016
  • December 2015
  • October 2015
  • September 2015
  • June 2015
  • May 2015
  • March 2015
  • February 2015
  • January 2015
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014

Categories

  • 0x80070003
  • Backup SiteCollection
  • BCS
  • BDC Identity
  • Download File
  • GitHub
  • Microsoft Flow
  • Microsoft PowerApps
  • MongoDB
  • Office365
  • Power Automate
  • SharePoint
  • SharePoint Apps
  • SharePoint DateTime
  • SharePoint Fields
  • SharePoint Grouping
  • SharePoint hidden list
  • SharePoint Installation
  • SharePoint List
  • SharePoint ListItem
  • SharePoint Localization
  • SharePoint Managed Metadata
  • SharePoint Online
  • SharePoint Online List
  • SharePoint Online List Field
  • SharePoint Online ListItem
  • SharePoint Online Search
  • SharePoint Online Site
  • SharePoint Online Theme
  • SharePoint Online User
  • SharePoint Online View
  • SharePoint REST
  • SharePoint Timer Job
  • SharePoint Update
  • SharePoint UserProfile
  • SharePoint WebPart
  • SiteCollection Restore
  • SPFx
  • SQL Server
  • Upload a File to SharePoint Online
  • Visual Studio
  • Visual Studio Team Services
  • wsp

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com
Create a website or blog at WordPress.com
Back to top
  • Follow Following
    • Piyush K Singh
    • Join 42 other followers
    • Already have a WordPress.com account? Log in now.
    • Piyush K Singh
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Our Cookie Policy