共用方式為


Troubleshoot SharePoint Online with Live Examples-- (1) SiteManager.aspx page cannot open

Like it or not, SharePoint is going more and more towards cloud. The number of users on SharePoint Online has increased quickly. However, the number of available troubleshooting guidelines for SharePoint Online are inappropriately few, and the quality is poor as well. Admins are taught to just make a phone call when it doesn’t work. Without knowing the basic steps, the experience of problem solving becomes especially painful and sometimes it leads to bad results, which should have been avoided.

This series of posts are supposed to help the admins handle problems better and work with support engineers more efficiently/smoothly, by reviewing real world examples how the problems are solved.

In this very first post, we will go through an error encountered in the SiteManager.aspx by a customer.

In site settings page of a portal site, there is a link of “Content and Structure”, which refers to the SiteManager.aspx page.  This page manages all the sub-sties/libraries/lists/folders in a site with a tree-view navigation in the left, and a content pane in the right.

For this customer, the SiteManager.aspx cannot render the site contents and it displays a message like follows.

Sorry, something went wrong

An unexpected error has occurred.

Technical Details

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: a5fc289d-a0a4-2000-22dc-0dbea4e8bc18

Date and Time: 8/30/2015 12:58:38 AM

Such error message is familiar to many users. However, few people realize there is important information inside it. The most important is the “Correlation ID”. SharePoint is a sophisticated software which writes very detail logs for each user operation. The “Correlation ID” is the unique id for your specific page request, and is the key to find the relevant logs among billions of lines of other log entries.

So the very first thing the admin can do when reporting an error, is to provide the Correlation ID. Because the huge amount of log entries generated each minute, the logs won’t be kept for long. So the admin needs to provide the Correlation ID in time, best in one day.

Now I will explain a little bit what the Microsoft Support does behind the scene.

After retrieving the logs of the Correlation ID, the support needs to scrutinize the logs for useful information. Below is the one with the exact error message and CallStack.

Application error when access /_layouts/15/sitemanager.aspx, Error=Object reference not set to an instance of an object.  

 at Microsoft.SharePoint.Publishing.CommonUtilities.ConcatUrlsOrFileSystemPaths(String firstPart, String secondPart, String separatorString)    

 at Microsoft.SharePoint.Publishing.Internal.WebControls.SmtUrlGenerator.GetListNewItemLink(ICachedList list, String webServerRelativeUrl, Boolean includeQueryString)    

 at Microsoft.SharePoint.Publishing.Internal.WebControls.SmtListEcbMenu.setupTypeSpecificMenu()    

 at Microsoft.SharePoint.Publishing.Internal.WebControls.SmtEcbMenuFactory.CreateSmtEcbMenu(Control ownerTreeView, ISmtPageControl smtPageControl, ObjectSerializer treeViewObject, ObjectSerializer treeViewObjectParent, String menuPrefix)    

 at Microsoft.SharePoint.Publishing.Internal.WebControls.SmtTreeNode.createEcbMenu(Control ownerTreeView, ObjectSerializer treeViewObject, ObjectSerializer treeViewObjectParent)    

 at Microsoft.SharePoint.Publishing.Internal.WebControls.EcbEnabledTreeNode.RenderPreText(HtmlTextWriter writer)    

 at System.Web.UI.WebControls.TreeNode.Render(HtmlTextWriter writer, Int32 position, Boolean[] isLast, Boolean enabled)    

 at System.Web.UI.WebControls.TreeNode.RenderChildNodes(HtmlTextWriter writer, Int32 depth, Boolean[] isLast, Boolean enabled)    

 at System.Web.UI.WebControls.TreeNode.Render(HtmlTextWriter writer, Int32 position, Boolean[] isLast, Boolean enabled)    

 at System.Web.UI.WebControls.TreeView.RenderContents(HtmlTextWriter writer)    

 at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)    

 at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)    

 at ASP._layouts_15_sitemanager_aspx.__RenderForm1(HtmlTextWriter __w, Control parameterContainer)    

 

CallStack reveals the source code that hit the problem. In this case, the highlighted method of Microsoft.SharePoint.Publishing.CommonUtilities.ConcatUrlsOrFileSystemPaths encountered a null object reference. That means, it expects an instantiated object, but the object doesn’t exist. In this case, source code analysis is required to understand the possible cause(s) of this error. Usually there will be more than one possibilities. In this case, the mostly likely cause is a list doesn’t have a “New Item Form”.

Each list by default has a “New Item Form”, which is used when you click the “New Item” menu button of the list. It can be edited/deleted in SharePoint Designer though. By deleting it in my test tenant, I can reproduce the same error message as customer’s. By far, we have a possible cause, but still we lack below important facts:

  1. We don’t know for sure this is the same issue in customer’s site. No matter how alike the symptoms are, it is possible it is something else.

  2. Assume there is a list that gets the “New Item Form” missing, how can we find it? If there are just a few lists, it won’t be of too much effort. However, for many customers, there might be hundreds, if not thousands of lists in a site. Unfortunately, this customer is one of them. So it is hard to narrow down to the victim(s) by click and open the lists one by one.

Now what should I do? It seems some automation is needed to examine the list’s in a site, specifically, to find out those w/o “New Item Form”. That’s when the SharePoint client object model (CSOM) comes into play. If you are interested, this article describes most operations can be done programmatically. You can run the CSOM code with client application built with C#/VB.NET, or JavaScript on a SharePoint page, or PowerShell script within the SharePoint Online Management Shell, which is my favorite because of its convenience.

Set-ExecutionPolicy Unrestricted -Force

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

 

$siteURL = "https://<site_URL>/"

$username = "<admin_email>."

$password = "<password>"

 

$securePassword = ConvertTo-SecureString $password -AsPlainText -Force

$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)

 

$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)

$context.AuthenticationMode = [Microsoft.SharePoint.Client.ClientAuthenticationMode]::Default

$context.Credentials = $credentials

 

$web = $context.Web

$context.Load($web.Lists)

$context.ExecuteQuery()

foreach($list in $web.Lists){

    $context.Load($list)

    $context.Load($list.Forms)

    $context.ExecuteQuery()

    if($list.BaseType -ne "DocumentLibrary" -and $list.Hidden -eq $false){

        $form = $list.Forms|?{$_.FormType -eq "NewForm"}

        $msg = $list.Title + ":" + $form.ServerRelativeUrl

        echo $msg

    }

}

 

The above script enumerates all the lists in a site, along with their New Item Form’s URLs. From the result, we can easily find out those whose New Item Form URLs are empty.

My customer ran it, and they did find two such lists. After adding the New Item Forms with SharePoint Designer to those two lists, the SiteManager.aspx page comes back successfully.

Now let’s retrospect the interactions between a SharePoint admin and a Microsoft support.

Step 1: the admin provides a Correlation ID and tells the support the SiteManager.aspx goes wrong.

Step 2: the support extracts Logs with the ID, and research the possible causes.

Step 3: the support tells the admin that possibly some lists w/o new item form result in the error.

Step 4: the admin tells the support engineer it is hard to examine all lists manually, and requests some easier way.

Step 5: the support engineer comes up with a PowerShell script and guidelines to install the SharePoint Online Management Shell. Then the admin follows the instruction and fixes the problem.

Then what can the admin do to improve the process?

In step 1, as we have mentioned earlier, to provide the correlation Id in time is very important. In step 4, some admins with coding experience can do it by themselves, although It is not necessary. But once you grasp the skill, you’ll find it extremely useful. Many management work otherwise impossible or very time-consuming, can be achieved with ease.  

Despite the fact that it is literally forbidden to provide an admin account to a support engineer, in practice it can accelerate the troubleshooting by eliminating unnecessary roundtrips during the process. Even providing a temp account would be very helpful. We were very lucky in this case and the root cause was found with only one shot. But sometimes it can take far many roundtrips before a problem is solved.

Of course, the security risk does exist. So balance the risk (the importance of the data, the credibility of the support engineer, etc.) and efficiency, and make a smart decision. As you can see from above analysis, the more skills you grasp, the less dependencies you have on the others, and the quicker you can solve a problem.

That’s all for the first post. Hope everyone enjoys it.