Ribbon missing on SharePoint List or Library page SharePoint 2013

This article is related to below post where user reported missing ribbon issue after migration from SharePoint 2007 to 2013 version.



Ribbon not visible on SharePoint List/Library page load. Mostly reported after site migration from 2007 to 2010/2013 version. Also if you have added a content editor web part on this page.


01.<scripttype="text/javascript"src="https://code.jquery.com/jquery-1.11.3.min.js "></script>
04.var elem = document.getElementById("MSOZoneCell_WebPartWPQ2");
05.           if(elem != null) {
06.                var dummyevent = new Array();
07.                dummyevent["target"] = elem;
08.                dummyevent["srcElement"] = elem;
09.                WpClick(dummyevent);
10.                _ribbonStartInit("Ribbon.Browse", true)
11.            }
12. });

Copy sharepoint views to other libraries powershell



Function Copy-SPView

Write-Host &quot;Loading Sytem Modules &quot;
Get-Module -listAvailable | import-module

if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
Write-Host &quot;Loading Sharepoint Module &quot;
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell

if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell) -eq $null )
Write-Host &quot;Failed to load sharepoint snap-in. Could not proceed further, Aborting …&quot;

Start-SPAssignment -Global

$SPWeb  = Get-SPWeb -Identity $WebURL -ErrorAction SilentlyContinue
$SPWebT = Get-SPWeb -Identity $TargetURL -ErrorAction SilentlyContinue

$ignoreList = &quot;Customized Reports&quot;,&quot;Form Templates&quot;,&quot;Shared Documents&quot;,&quot;Site Assets&quot;,&quot;Site Pages&quot;,&quot;Style Library&quot;,&quot;Master Page Gallery&quot;,&quot;Picture&quot; + $SourceList + $IgnoreLibs

if($SPWeb -eq $null){ Write-Host &quot;Unable to reach the provided URL, Aborting …&quot; ;Exit }
if( ($SPWeb.Lists.TryGetList($SourceList) ) -eq $Null){ Write-Host &quot;The list $SourceList is not availible, Aborting …&quot;; Exit }
if($AsDefault -ne $True){$AsDefault = $False}


if( ($SourceLists.Views[$SourceView]) -eq $Null ){ Write-Host &quot;The view $SourceView does not exist, Aborting …&quot;; Exit  }
if($NewViewName -lt 1){ $NewViewName = $SourceView }

Go through each document library in the target site

$listIds = @();
$i = 0;

if($SPWebT -ne $null)

while ($i -lt $lists.Count)
$list = $lists[$i]

if($list.BaseType -eq &quot;DocumentLibrary&quot;)
if ($Ignorelist -contains $list.Title)
write-host $list &quot;is Ignored&quot; -foregroundcolor Yellow -backgroundcolor Black
$view = $list.Views[$NewViewName]
if ($view -ne $null)
Write-Host &quot;Updating existing view&quot; -foregroundcolor Yellow -backgroundcolor Black


$Viewfields = $Sourcelists.Views[$SourceView].ViewFields.ToStringCollection()

Setting the Query for the View

$viewQuery = $Sourcelists.Views[$SourceView].Query
$viewName = $NewViewName

Finally – Provisioning the View

$myListView = $list.Views.Add($viewName, $viewFields, $viewQuery, 100, $True, $False, &quot;HTML&quot;, $False)
Write-Host &quot;Not all columns are availible in the target library&quot; -foregroundcolor Yellow

You need to Update the View for changes made to the view

Updating the List is not enough

$myListView.DefaultView = $AsDefault

Write-Host &quot;$viewName added to Library $list&quot;
$i = $i + 1

Copy-SPView ($WebURL,$SourceList,$SourceView,$NewViewName)

Using this script it’s possible to copy views from a source library to any target library.
This includes copying views to libraries in other site collections / web applications or even other SharePoint servers!

Summary of possible variables:

– WebURL
URL of the source library
– SourceList
Displayname of the source library what contains the view
– SourceView
Name of the view that needs to be copied
– NewViewName
Name of the view in the target libraries. (if left empty the source view name will be used.)
– TargetURL
URL of the target site / site collection of web application (If left empty the libraries in the WebURL are being
– IgnoreLibs
Name of the libraries that need to be ignored.
(The script contains a list of SharePoint Household Libraries
that are ignored by default including the Source Library.)
“Customized Reports”,”Form Templates”,”Shared Documents”,”Site Assets”,”Site Pages”,
“Style Library”,”Master Page Gallery”,”Picture”

.Example 1

This example copies the view to all document libraries within the source URL

PS C:> .Copy-SPView.ps1 -WebURL <source URL> -SourceList <Your Source Library> -SourceView <Name of View>

.Example 2

This example copies the view to all document libraries within the target URL.

PS C:> .Copy-SPView.ps1 -WebURL <source URL> -SourceList <Your Source Library> -SourceView <Name of the View> -TargetURL “<Your target URL>”

.Example 3

This example shows all possible variables that are currently working.

PS C:> .Copy-SPView.ps1 -WebURL <source URL> -SourceList <Your Source Library> -SourceView <Name of the View> -TargetURL “<Your target URL>” -NewViewName “Rogier’s View” -IgnoreLibs “Shared Documents”

Please let me know if this was helpful