Posts

Showing posts from February, 2015

Delete Term Group using PowerShell

Below is a script that I used to delete a term group and all the term sets within that group. $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} if ($snapin -eq $null) {   Write-Host "`nLoading SharePoint Powershell Snapin`n"   Add-PSSnapin "Microsoft.SharePoint.Powershell" } function DeleteTermGroup { $centralAdmin = Read-Host "Central Admin Url:" $termstoreName = "Term Store Name" $groupName = Read-Host "Group name" $site = Get-SPSite $centralAdmin $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site) $termstore = $session.TermStores[$termstoreName] $group=$termStore.Groups[$groupName] $group.TermSets|foreach{ $_.Delete() $termstore.CommitAll() }     $group.Delete() $termstore.CommitAll() Write-Output "Deleted $groupName" } DeleteTermGroup $input = Read-Host "Enter any key to exit" Exit

SharePoint 2013 - Get Variation URL using JSOM

From the variation information on this blog, http://blogs.technet.com/b/stefan_gossner/archive/2011/11/21/sharepoint-variations-the-complete-guide-part-6-configuration-internals.aspx, I used the following code to get the corresponding variation URL to create the toggling button for a publishing site. Type.registerNamespace('spapp'); var context; spapp.url = "https://rchen.sp.com"; spapp.language; spapp.languageHome; spapp.curPageUrl; spapp.relationshipList; spapp.relationshipItems; $(document).ready(function () { var toggleHtml = ' Toggle '; $('#RibbonContainer-TabRowRight').prepend(toggleHtml); SP.SOD.executeFunc('sp.js', 'SP.ClientContext', spapp.init); }); spapp.init = function(){ context = new SP.ClientContext(spapp.url); }; spapp.toggleLanguage = function(){ spapp.curPageUrl = _spPageContextInfo.serverRequestPath; spapp.language = _spPageContextInfo.currentCultureName; spapp.relationshipList =