Archive for the ‘SharePoint 2013’ Tag

How To Add the Schools of the World as a Metadata Termset   Leave a comment

This took quite some time to gather and place into a Microsoft Excel worksheet but I persevered through the tedious effort to build a TermSet of what I call the “Schools of the World”.  This PowerShell script will populate a “Schools” termset with all of the known (as of today) Colleges and Universities on planet Earth.

To run, execute PowerShell as an Administrator or the SharePoint Setup Account. Navigate to the folder where the Script and .CSV file reside and type

.\SP-ImportTermSet.ps1 http://mysites.portal.contoso.com SchoolsTermSet.csv

This will add a “Schools” termset under the “People” Term Group.

Note: if “Schools” has not already been provisioned, your will need to run the script twice.  First to provision the termset, and second to populate it with the terms.

Download the SchoolsTermSet and rename it to SchoolsTermSet.csv, then copy the PowerShell Termset Installer below as SP-ImportTermSet.ps1.

PowerShell Script: SP-ImportTermSet.ps1

#*******************************************************************************
#*        Author: Paul D. Fox
#*          Date: 05/08/2014
#*   Description: PowerShell Script to Import TermSets into the Managed Metadata
#*                Term Store from a .CSV of specified terms.
#*
#* Modifications: MM/DD/YYYY – Description
#*
#*     Execution: Modify the parameters below to coincide with your Farm
#*                Credentials, Managed Metadata Service Name, and Term Group
#*      Description. To run this script create open the SharePoint
#*                Management Shell and Execute the following from the directory
#*                where the .csv resides.
#*
#* To Execute, type the following:
#* .\SP-ImportTermSet.ps1 “http://mysites.portal.contoso.com” “SchoolsTermSet.csv”
#*
#*******************************************************************************
param(
[string]$siteUrl,
[string]$inputFile)

[string]$termStoreName = “Managed Metadata Service Proxy”
[string]$termGroupName = “People”
[string]$termGroupDescription = “Term Store used to Extend User Profile Information”
[string]$termGroupMgr = “CONTOSO\SPFarmAdmin”
[string]$termGroupContributor = “CONTOSO\SPFarmAdmin”
[string]$termSetDescription = “Schools”
[string]$termSetOwner = “CONTOSO\SPFarmAdmin”
[string]$termSetStakeholder = “CONTOSO\SPFarmAdmin”

#Add the SharePoint PowerShell Snap-In
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#*******************************************************************************
#* Check if both params are passed, else show Syntax.
#*******************************************************************************

if ($siteUrl -eq “”)
{
“Syntax: S2-ImportTermSet , ”
exit;
}
if  (-not($siteurl.ToLower().StartsWith(“http`://”)))
{
“Invalid Web Application Url”
“Syntax: Build-CbMySites ”
exit;
}
if ($siteurl.EndsWith(“/”))
{
$siteurl = $siteurl.Substring(0,$baseUrl.Length -1)
}
#*******************************************************************************
# [string]$siteUrl = $(Read-Host -prompt “Site Collection URL”),
# [string]$termStoreName = $(Read-Host -prompt “Term Store Name”),
# [string]$termGroupName = $(Read-Host -prompt “Term Group Name”),
# [string]$termSetName = $(Read-Host -prompt “Term Set Name”),
# [string]$inputFile = $(Read-Host -prompt “Input File (including full path)”))
#*******************************************************************************

[Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Taxonomy”) > $null

function Get-SpTermGroup
{
$termGroup = $termStore.Groups[$termGroupName];
if ($termGroup -ne $null)
{
return $termGroup
}
else
{
$termGroup = $termStore.CreateGroup($termGroupName)
$termGroup.Description = $termGroupDescription
$termStore.CommitAll()
$termGroup.AddGroupManager($termGroupMgr)
$termGroup.AddContributor($termGroupContributor)
$termStore.CommitAll()
return $termGroup
}
}

function Get-SpTermSet([string]$termSetName)
{
$termSet = $termGroup.TermSets[$termSetName];
if ($termSet -ne $null)
{
return $termSet
}
else
{
$termSet = $termGroup.CreateTermSet($termSetName)
$termSet.Description = $termSetDescription
$termSet.Owner = $termSetOwner
$termStore.CommitAll()
$termSet.AddStakeholder = $termSetStakeholder
$termStore.CommitAll()
return $termSet
}
}

function Add-SpTerm([string]$termName, $parentTerm)
{
try
{
if ($parentTerm -eq $null)
{
$term = $termSet.CreateTerm($termName, 1033);
}
else
{
$term = $parentTerm.CreateTerm($termName, 1033);
}
if ($term -eq $null)
{
Write-Host “Term $termName could not be created” -ForegroundColor Red
}
else
{
$term.IsAvailableForTagging = $available ;
write-host “Term $termName has been created”
if ($synonyms.Count -gt 0)
{
foreach ($synonym in $synonyms)
{

$term.CreateLabel($synonym,1033, $false);
write-host ”    Synonym $synonym has been created”
}
}
$termSet.TermStore.CommitAll();
}
}
catch { }
return $term
}

function Get-SpTerm([string]$termName, $parentTerm)
{
if ($parentTerm -ne $null)
{
$term = $parentTerm.Terms[$termName];
}
else
{
$term = $termSet.Terms[$termName];
}
if ($term -eq $null)
{
$term = Add-SpTerm $termName $parentTerm
}
return $term
}

function Import-SPTermStoreGroupTerms
{
$isValid = $true;
$message = “”;
if ($siteUrl.Length -eq 0)
{
$message = “`nPlease provide a site URL”;
$isValid = $false;
}
if ($termStoreName.Length -eq 0)
{
$message += “`nPlease provide a Term Store Name”;
$isValid = $false;
}
if ($termGroupName.Length -eq 0)
{
$message += “`nPlease provide a Term Store Group Name”;
$isValid = $false;
}
if ($inputFile.Length -eq 0)
{
$message += “`nPlease provide an input file”;
$isValid = $false;
}
else
{
$csv = Import-csv -path $inputFile
if ($csv -ne $null)
{
[string]$termSetName =  $csv[0].”Term Set Name”;
if ([string]::IsNullOrEmpty($termSetName))
{
$message += “`nPlease provide a Term Set Name”;
$isValid = $false;
}
}
else
{
return “Argument supplied for input file was invalid.”;
}
}
if ($isValid -eq $false)
{
write-host “`n`nERROR OCCURRED`n`t$message`n`n”
write-host “NAME`n`tImport-SPTermStoreGroupTerms`n”
write-host “SYNOPSIS`n`tConsumes a CSV file containing a listing of term names and creates them if needed in the specified term set.`n”
write-host “SYNTAX`n`tImport-SPTermStoreGroupTerms siteUrl termStoreName termGroupName termSetName inputFile`n”
write-host “EXAMPLES`n`n Import-SPTermStoreGroupTerms “”http://sp2010″” “”Managed Metadata Service”” “”Enterprise Metadata”” “”Business Units”” “”C:\Users\Me\Desktop\input.csv””`n”
write-host “SAMPLE INPUT FILE`n`tTerm`n`tSample Term 1`n`tSample Term 2`n`tSample Term 3`n”
return;
}
try
{
$ErrorActionPreference = “Stop”;
try
{
$taxSession = Get-SPTaxonomySession -Site $siteUrl;
try
{
$termStore = $taxSession.TermStores[$termStoreName];
if ($termStore -ne $null)
{
try
{
$termGroup = Get-SpTermGroup
if ($termGroup -ne $null)
{
try
{
$termSet = Get-SpTermSet $termSetName
if ($termSet -ne $null)
{

foreach($line in $csv)
{
$available = $false
$synonymList= $null
$synonyms = $null
[string]$termName1 = $line.”Level 1 Term”;
[string]$termName2 = $line.”Level 2 Term”;
[string]$termName3 = $line.”Level 3 Term”;
[string]$termName4 = $line.”Level 4 Term”;
[string]$termName5 = $line.”Level 5 Term”;
[string]$termName6 = $line.”Level 6 Term”;
[string]$termName7 = $line.”Level 7 Term”;
[string]$switch = $line.”Available for Tagging”;
[string]$synonymList = $line.”Synonyms”;
if (-not ([string]::IsNullOrEmpty($synonymList)))
{
$synonyms = $synonymList.Split(“|”);
}
if ($switch.ToLower() -eq “true”)
{
$available = $true
}
#Get Level 1 Term
$term = Get-SpTerm $termName1

if (-not ([string]::IsNullOrEmpty($termName2)))
{
$term = Get-SpTerm $termName2 $term
if (-not ([string]::IsNullOrEmpty($termName3)) )
{
$term = Get-SpTerm $termName3 $term
if (-not ([string]::IsNullOrEmpty($termName4)) )
{
$term = Get-SpTerm $termName4 $term
if (-not (![string]::IsNullOrEmpty($termName5)) )
{
$term = Get-SpTerm $termName5 $term
if (-not (![string]::IsNullOrEmpty($termName6)) )
{
$term = Get-SpTerm $termName6 $term
if (-not (![string]::IsNullOrEmpty($termName7)))
{
$term = Get-SpTerm $termName3 $term
}
else
{
return “Error:  Term Name Left Blank”;
}
}
}
}
}
}
}
}
else
{
return “Termset $termSetName does not exist in the term store group $termGroupName”;
}
}
catch
{
“Unable to acquire the termset $termSetName from the term group $termGroupName”
}
}
else
{
return “Term store group $termGroupName does not exist in the term store $termStoreName”;
}
}
catch
{
“Unable to acquire term store group $termGroupName from $termStoreName”
}
}
else
{
return “Term store $termStoreName does not exist”;
}
}
catch
{
“Unable to acquire term store for $termStoreName”
}
}
catch
{
“Unable to acquire session for the site $siteUrl”
}
}
catch { }
finally
{
$ErrorActionPreference = “Continue”;
}
}
Import-SPTermStoreGroupTerms
Remove-Variable * -Scope Local -ErrorAction SilentlyContinue

Bismarck!

Posted June 24, 2015 by Bismarck in SharePoint 2013

Tagged with

How To Build a SharePoint Development Standards Document   Leave a comment

Building upon the SharePoint Governance Plan document that I posted the other day, I began creating a Development Standards document for SharePoint.  This is something of a good idea if you either have a large team of designers and developers enhancing and extending the SharePoint platform.  In addition, its  good idea to have some kind of standards document for your organization when utilizing contractors or consultants as additional resources that will only be available temporarily.

This is my first draft at such a document.  It covers both SharePoint 2010 and SharePoint 2013.  I still have some images to add to the document (you will see my placeholders), and I don’t have much of anything for Standards on App Model development.  If you already have standards for this I’d love to hear about it.

So in the spirit of sharing my work, feel free to download this SharePoint Development Standards Development Document.  Hopefully I will get the time to move it out of draft state soon.

Download the SharePoint Development Standards Document.

Bismarck!

Posted June 5, 2015 by Bismarck in SharePoint 2013

Tagged with

How To Build a SharePoint Governance Document   Leave a comment

I have been working with SharePoint since version 2003.  I didn’t begin developing a Governance document until after considerable months with version 2007 and realizing that the platform was just too big to be without such a document.  I’ve gone through several iterations since then.  Once in SharePoint 2010 and now in SharePoint 2013 I feel its complete enough for myself.  I have seen several attempts on the Web at this endeavor and they just didn’t appear comprehensive enough.  I also captured snippets here and there from the Web and through SharePoint Saturday’s and conversations.

So I now have a complete SharePoint 2013 Governance document I’d like to share with the rest of the world. Click on the Hyperlink below and enjoy.

Download the SharePoint 2013 Governance Plan.

Regards,

Bismarck

Posted June 3, 2015 by Bismarck in SharePoint 2013

Tagged with

How To Extend the Global Navigation Beyond Two Levels   1 comment

In this post, I will show you how to extend the SharePoint 2013 Global Navigation (Top Navigation) beyond the default of two levels.

When using the Global Navigation either within the Site Collection Navigation properties or with using Managed Metadata, the default level is set to Two within the TopNavigationMenu control in the Masterpage.  By editing the Masterpage, locate the ID=”TopNavigationMenu” ASPMenu control and change the following property: MaximumDynamicDisplayLevels=”3″.

How To Extend the Global Navigation Another Level in MasterPage for SharePoint 2013

Happy SharePointing!

Posted January 30, 2015 by Bismarck in SharePoint 2013

Tagged with

How To Hide Site Setting Links in SharePoint 2013   Leave a comment

There may be specific instances where you want to have more control over your Site Owners.  Once such instance is controlling what Site Setting Configurations they have access to.  This post does not address security or permissions, but instead shows you how to remove (Hide) certain links from the Site Settings page in SharePoint 2013.

A typical scenario may be when you have some custom Branding, Navigation or Search Configuration and want to remove those links from being shown.

Note: This does not remove access to the page.  Simply type in the URL directly to access the specific page settings.  My thought on this was the “Out of Site, Out of Mind” approach.

What I did.

I created a SharePoint Feature with a Custom Action to remove specific Links from the Site Settings Application Page. You can obtain the links by holding your mouse over the link and capturing the URL from the Browser Status Window.

How to Do it.

1. Create an empty Visual Studio 2013 SharePoint project.

2. Create a Feature and Scope it to “Site”

3. Add a Custom Action with the following Elements.xml file.  I have tried to explain as much as possible to help you along. (I’ve commented out some of the links, you can incorporate them as well by removing the command tags.)

Elements.xml

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

<!– *******************************************************************–>
< !– *  Trim Site Settings Custom Action Elements File contains the Actions
< !– *  to Remove the Navigation Links.  To locationt the proper “Group Id”
<!– *and “HideActionId” use the IE  Developer Toolbar to obtain the ID label.
< !– *  Example:
< !–* id=”ct100_PlaceHolderMain_Customization_RptControls_DesignEditor”
<!– *  Where GroupId = “Customization” and HideActionId = “DesignEditor”
<!– *******************************************************************–>

<!– *******************************************************************–>
< !– *                             Site Settings Look and Feel                                                 *–>
< !– *******************************************************************–>

<!– Removes the ‘Design Manager’ Navigation Link from Site Settings Page under Look and Feel –>
< HideCustomAction
Id = “HideImportDesignPackage”
GroupId = “Customization”
HideActionId = “DesignEditor”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– Removes the ‘Master Page’ Navigation Link from Site Settings Page under Look and Feel –>
< HideCustomAction
Id=”HideSiteActionFeatures”
GroupId=”Customization”
HideActionId=”AreaChromeSettings”
Location=”Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– Removes the ‘Site Title, Description and Icon’ Navigation Link from Site Settings Page under Look and Feel –>
< !–
<HideCustomAction
Id = “HideProjectSettings”
GroupId = “Customization”
HideActionId = “ProjectSettings”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>
< !– Removes the ‘Device Channels’ Navigation Link from Site Settings Page under Look and Feel –>

<HideCustomAction
Id = “HideDeviceChannels”
GroupId = “Customization”
HideActionId = “DeviceChannelSettings”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
< !– Removes the ‘Change the Look’ Navigation Link from Site Settings Page under Look and Feel –>
< HideCustomAction
Id = “HideChangeTheLook”
GroupId = “Customization”
HideActionId = “Theme”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– Removes the ‘Import Design Package’ Navigation Link from Site Settings Page under Look and Feel –>
< HideCustomAction
Id = “HideImportDesignPackage”
GroupId = “Customization”
HideActionId = “DesignImport”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– *******************************************************************–>
< !– *                                   Web Design Galleries                                                      *–>
< !– ********************************************************************–>

<!– Removes the ‘Themes’ Navigation Link from Site Settings Page under Web Design Galleries –>
< HideCustomAction
Id = “HideThemes”
GroupId = “Galleries”
HideActionId = “Themes”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– Removes the ‘Solutions’ Navigation Link from Site Settings Page under Web Design Galleries –>
< HideCustomAction
Id = “HideThemes”
GroupId = “Galleries”
HideActionId = “Solutions”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– Removes the ‘Composed Looks’ Navigation Link from Site Settings Page under Web Design Galleries –>
< HideCustomAction
Id = “HideComposedLooks”
GroupId = “Galleries”
HideActionId = “Designs”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– *******************************************************************–>
< !– *                                       Site Actions                                                                    *–>
< !– *******************************************************************–>

<!– Removes the ‘Manage Site Features’ Navigation Link from Site Settings Page under Site Actions –>
< !–
<HideCustomAction
Id =”HideManageSiteFeatures”
GroupId = “SiteAdministration”
HideActionId =”ManageSiteFeatures”
Location =”Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>

<!– Removes the ‘Delete this Site’ Navigation Link from Site Settings Page under Site Actions –>
< HideCustomAction
Id=”HideDeleteThisSite”
GroupId=”SiteTasks”
HideActionId=”DeleteWeb”
Location=”Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

<!– *******************************************************************–>
< !– *                                     Site Administration                                                       *–>
< !– *******************************************************************–>

<!– Removes the ‘Variation Settings’ Navigation Link from Site Settings Page under Site Administration –>
< !–
<HideCustomAction
Id=”HideSiteVariationSettings”
GroupId=”SiteAdministration”
HideActionId=”VariationsNominateSiteLink”
Location=”Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>

<!– *******************************************************************–>
< !– *                                    Reporting Services                                                         *–>
< !– *******************************************************************–>

<!– Removes the ‘Reporting Services Site Settings’ Navigation Link from Site Settings Page under Reporting Services –>
< !–
<HideCustomAction
Id=”HideReportingServicesSiteSettings”
GroupId=”ReportServerSettingsLinks”
HideActionId=”ReportServerSiteLevelSettings”
Location=”Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>

<!– *******************************************************************–>
< !– *                                          Search                                                                         *–>
< !– *******************************************************************–>

<!– Removes the ‘Search Settings’ Navigation Link from Site Settings Page under Search –>
< !–
<HideCustomAction
Id=”HideSearchSettings”
GroupId=”SearchAdministration”
HideActionId=”SiteSearchSettings”
Location=”Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>

<!– *******************************************************************–>
< !– *                               Site Collection Administration                                        *–>
< !– *******************************************************************–>

<!– Removes the ‘Site Collection Features’ Navigation Link from Site Settings Page under Site Collection Administration –>
< !–
<HideCustomAction
Id = “HideSiteCollectionFeatures”
GroupId = “SiteCollectionAdmin”
HideActionId = “ManageSiteCollectionFeatures”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>

<!– Removes the ‘Variations Settings’ Navigation Link from Site Settings Page under Site Collection Administration –>
< !–
<HideCustomAction
Id = “HideSiteCollectionFeatures”
GroupId = “SiteCollectionAdmin”
HideActionId = “VariationSettings”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>
–>

<!– Removes the ‘SharePoint Designer Settings’ Navigation Link from Site Settings Page under Site Collection Administration –>
< HideCustomAction
Id = “HideSharePointDesignerSettings”
GroupId = “SiteCollectionAdmin”
HideActionId = “SharePointDesignerSettings”
Location = “Microsoft.SharePoint.SiteSettings”>
< /HideCustomAction>

</Elements>

I will try to post a project solution on CodePlex soon.  So look out for it.

Happy SharePointing!

Bismarck

Posted December 11, 2014 by Bismarck in SharePoint 2013

Tagged with