Subscribe: SharePoint SharePoint SharePoint

Wednesday, January 29, 2014

Migrating Managed Metadata Term Stores in SharePoint Server across Farms

While moving a site from development environment to production environment, it is recommended to move MMS term stores too. We can actually adopt two approaches to this:

1. Export Term Stores in a .csv file and then Import them to target server.
2. Use a powershell script to create a .cab file to import on target server.

SharePoint

The first approach is easier but has a major drawback. It does not persist the GUID of the terms. This may lead to many errors in the imported site because some web parts might be dependent on a term's guid.

e.g. if i have a CQWP which shows filtered data as per a MMS term, then in the target server the filtering would be lost.

So a better and safe way is to export and import MMS using Powershell:

Export

SharePoint

 Add-PSSnapin Microsoft.SharePoint.Powershell
 $metadataApp= Get-SpServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
 $mmsAppId = $metadataApp.Id

 $mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}
 Export-SPMetadataWebServicePartitionData -Identity $mmsAppId -ServiceProxy $mmsproxy -Path "C:\Users\Desktop\MMD.cab”

Import


SharePoint

Add-PSSnapin Microsoft.SharePoint.Powershell
 $metadataApp= Get-SpServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
 $mmsAppId = $metadataApp.Id

 $mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}

Import-SPMetadataWebServicePartitionData -Identity $mmsAppId -ServiceProxy $mmsproxy -Path "//SharedPath/Users/Desktop/MMD.cab" -OverwriteExisting;

NOTE: While importing make sure the .cab file is in a network path accessible to SQL Server with ContentDB and which has been shared with the user account of the MMS Service.

Problems Adding Apps in SharePoint 2013

Sometimes adding an app in SharePoint 2013 does not work. It throws an error "Sorry,something went wrong". This can happen due to a lot of reasons. But when i ran through this problem it was because of using a custom master page.




My custom master page did not have a "Breadcrumb" content placeholder (PlaceHolderTitleBreadcrumb) But "adding apps" expected that content placeholder. So after adding it the problem was resolved.

Make sure you have all placeholders as below:

1. DeltaPlaceHolderLeftNavBar
2. PlaceHolderLeftNavBar
3. DeltaPlaceHolderPageTitleInTitleArea
4.  PlaceHolderPageTitleInTitleArea 

Also each of them should not be set to Visible=False


The code for the content placeholders are:

<SharePoint:AjaxDelta id="DeltaPlaceHolderLeftNavBar" BlockElement="true" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
</asp:ContentPlaceHolder>
</SharePoint:AjaxDelta
<SharePoint:AjaxDelta id="DeltaPlaceHolderPageTitleInTitleArea" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server">
</asp:ContentPlaceHolder><asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server" Visible="false"></asp:ContentPlaceHolder>
</SharePoint:AjaxDelta>

Saturday, July 6, 2013

Hiding Quick Launch in SharePoint

Hiding the quick launch in SharePoint can be done in a number of different ways but the easiest way is by overriding the current css class implemented by "Quick Launch"  in Content Editor WebPart (CEWP) :


Paste the following code in a CEWP and it will hide the quick launch bar :
SP2010
#s4-leftpanel{
display:none
}
.s4-ca{
margin-left:0px
}

SP2013
.ms-core-navigation { DISPLAY: none }
#contentBox { margin-left: 0px }