Showing posts with label SharePoint Managed Metadata. Show all posts
Showing posts with label SharePoint Managed Metadata. Show all posts

Thursday, August 15, 2019

Example Powershell to Automatically Update SharePoint Managed Navigation in Team Sites “associated” to a central Publishing Site


This set of Powershell commands goes along with a demonstration I do at various SharePoint conferences during my presentation titled “Making the Most of SharePoint Managed Metadata”.
In the demo, I show how you can achieve something similar to the global navigation experience that SharePoint Online now offers using Hub sites and associated Team Sites (see this blog post for what that is all about), but by using the traditional SharePoint Publishing Site template along with traditional Team Site templates.  This can be done in SharePoint Server 2010, 2013, 2016, 2019 and SharePoint Online.

In my demo, I show how to create a new Team Site and then “associate” it with the main Publishing site by inheriting (actually, the official terminology is “Pin Term with Children”) its Managed Metadata-based Global Navigation.

The only catch with this is that after the new Team Site is created and its Global Navigation “associated” with the central Publishing site, the Global Navigation in any existing Team Sites does not get automatically updated.  So, in my demo I run some SharePoint Powershell as the last step that will loop through all of the “associated” Team Sites and update their Managed Navigation settings to include the new Team Site.

This Powershell is very specific to my demonstration and only provided here as a resource for someone wanting to do something similar.  To use it, you would need to read through it and make an effort to think about what it is doing.  Then, you would need to figure out how you could adapt it to work in your specific scenario and\or environment.

Also, this Powershell will only work with on-premises SharePoint Server.  If you need for it to work with SharePoint Online, you would have to take the concepts and come up with your own SharePoint Online version.

Example from my “Making the Most of SharePoint Managed Metadata” demo:

       

Add-PSSnapin "Microsoft.SharePoint.PowerShell" –ErrorAction SilentlyContinue

#Set variables

#The name of the Term Store in the local SharePoint Farm
$termStoreName = "Managed Metadata Service"

#The name of the Global Term Group that is used in the central Publishing Site
$globalTermGroupName = "Navigation"
#The name of the Global Term Set that is used in the Global Term Group
$globalTermSetName = "Intranet Global Navigation"

#Get the list of site collections that are attached to the central Publishing site collection
#In this demo, I have a list named "IntranetAttachedSites" that has an item for each Team site collection that is to be "associated"
$requestPortalWeb = Get-SPWeb http://intranet/sites/requests
$list = $requestPortalWeb.Lists["IntranetAttachedSites"]
$listItems = $list.GetItems()


#Update the navigation for each attached site collection
foreach ($listItem in $listItems) 
{
    $localTermGroupName = $listItem["Term Group Name"]
    $localTermSetName = $listItem["Term Set Name"]

    $web= Get-SPWeb $listItem["Title"]
    $site = $web.Site
    $navSettings = New-Object Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings($web)
    $taxSession = Get-SPTaxonomySession -Site $site
    $termStore = $taxSession.TermStores[$termStoreName]

    $globalTermGroup = $termStore.Groups[$globalTermGroupName]
    $globalTermSet = $globalTermGroup.TermSets[$globalTermSetName]

    $localTermGroup = $termStore.Groups[$localTermGroupName]
    $localTermSet = $localTermGroup.TermSets[$localTermSetName]

    # remove all the existing terms from the local Term Set
    $localTermSet.Terms|ForEach-Object{$_.delete()}
    $termStore.CommitAll()

    # pin the terms to the local term set from the master term set
    $globalTermSet.Terms|ForEach-Object{
       $t = $localTermSet.ReuseTermWithPinning($_)
    }

    # copy the sort order from the master term set
    $localTermSet.CustomSortOrder = $globalTermSet.CustomSortOrder 
    $termStore.CommitAll()
}

       
 

Making the Most of SharePoint Managed Metadata – Managed Navigation Demo


Over the past couple of years (2018 and 2019), I have been making a presentation at several SharePoint conferences titled “Making the Most of SharePoint Managed Metadata”.  In the presentation, I do several demonstrations that show how to use some of the advanced features of the Managed Metadata Term Store to help your business users get more value.  In this blog post, I am providing the “backup” slides I have on hand for one of the demos in case something goes wrong with the live demo – such as loss of Internet connectivity!

Anyway, here are my “backup” slides for my Managed Navigation demo that essentially document what I show the crowd in the live demo. 

In this demo, I show how you can achieve something similar to the global navigation experience that SharePoint Online now offers using Hub sites and associated Team Sites (see this blog post for what that is all about), but by using the traditional SharePoint Publishing Site template along with traditional Team Site templates.  This can be done in SharePoint Server 2010, 2013, 2016, 2019 and SharePoint Online.

In my demo, I show how to create a new Team Site and then “associate” it (actually, the official terminology is “Pin Term with Children”) with the main Publishing site by inheriting its Managed Metadata-based Global Navigation.


Friday, June 20, 2014

Synchronizing SharePoint Managed Metadata with External Business Data


The primary gap in SharePoint 2010 and 2013 Managed Metadata Service Application is the lack of ability to synchronize the Term values in a Term Set with an external business data source (No, you can't do this with the out-of-the-box Business Connectivity Services feature).

For example, if you could automatically on a schedule, synchronize a Vendors Term Set with the Vendor names that exist in your Purchasing system's database, this would allow you to:

  1. Assign the appropriate Vendor name to a SharePoint document, such as a contract, that relates to that vendorAs I noted in my article earlier this week, assigning metadata values to documents in SharePoint can really improve findability of documents.  (If Vendor names is not the best example for your organization, how about Customer names, or Product names, or Facility names, etc?)
  2. Rely on the existing business process to keep the Term values up-to-date because the external system (Purchasing system in this case) is maintained by the appropriate individuals that handle that part of the business.

Wednesday, June 18, 2014

How Much Value is Your Organization Getting From SharePoint Managed Metadata? – and, My Top 5 Benefits


SharePoint Managed Metadata Term Store ToolI can remember sitting in the session at SPC 2009 in Las Vegas where the Microsoft Program Manager in charge of the SharePoint 2010 Managed Metadata Service Application proudly proclaimed that Managed Metadata was the best new feature of SharePoint Server 2010.  Normally, I don’t care for braggarts, but after seeing how the features worked and how good it was, I really felt like this guy truly had a license to brag on himself and his team.  They did a great job!

We will soon be coming up on five years of organizations having the opportunity to take advantage of the benefits of Managed Metadata.  How much value has your organization got out of this feature set?  Have you even started to use it yet?