Wednesday, April 8, 2015

Server Error in '/' Application” my profile in Mysite.

Issue Description

Error 1
I was browsing to the .../_layouts/settings.aspx page of my Mysite and was getting the below error

Error
An unexpected error has occurred.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: ed701c42-8302-42d4-8886-121e92484460
Date and Time: 5/28/2014 4:58:36 PM
 Go back to site

Error 2
Getting an error “Server Error in '/' Application” when tried to click my profile in Mysite.

Issue Details

On checking the logs and server event viewer I got the below error messages:

Error Logs



The user does not exist or is not unique.
Object Cache: The super user account utilized by the cache is not configured. This can increase the number of cache misses, which causes the page requests to consume unneccesary system resources.  To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperuseraccount -propertyvalue account -url webappurl'. The account should be any account that has Full Control access to the SharePoint databases but is not an application pool account.  Additional Data:  Current default super user account: SHAREPOINT\system


Could not get token super user token, reverting to system account.  User is "UserName"
stsadm -o setproperty -propertyname portalsuperuseraccount -propertyvalue account -url webappurl'
PortalSiteMapProvider was unable to fetch root node, request URL: /_layouts/settings.aspx, message: The user does not exist or is not unique., stack trace:  
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)   
 at Microsoft.SharePoint.Library.SPRequest.GetUserToken(String bstrUrl, String bstrLogin)   
 at Microsoft.SharePoint.SPWeb.GetUserToken(String userName)   
 at Microsoft.SharePoint.Publishing.CacheManager.<.ctor>b__0(SPSite newSite)   
 at Microsoft.SharePoint.Publishing.CommonUtilities.<>c__DisplayClass1.<RunWithElevatedSite>b__0()   
 at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)    
 at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)   
 at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.Publishing.CommonUtilities.RunWithElevatedSite(SPSite siteNonElev, Boolean allowUnsafeUpdates, ElevatedSiteProcessor callWithElevatedSite)   
 at Microsoft.SharePoint.Publishing.CacheManager..ctor(SPSite site)   
 at Microsoft.SharePoint.Publishing.CacheManager.GetManager(SPSite site, Boolean useContextSite, Boolean allowContextSiteOptimization)   
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.get_ObjectFactory()   
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.get_TryGetRootNode()


Failed to create a custom control 'PublishingSiteActionsMenuCustomizer', feature 'Publishing' (id:22a9ef51-737b-4ff2-9346-694633fe4416) using attributes (ControlSrc='', ControlAssembly='Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c', ControlClass='Microsoft.SharePoint.Publishing.WebControls.PublishingSiteActionsMenuCustomizer': System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.SharePoint.SPException: The user does not exist or is not unique. ---> System.Runtime.InteropServices.COMException (0x81020054): The user does not exist or is not unique.   
System.Web.HttpException: The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource.  A control with ID 'topSiteMap' could not be found.  


Issue Resolution

I analyzed that the issue was “object caching accounts don’t have the correct permission on the Mysite web application”. It was the superuser and superreader accounts-however, the issue was not that they weren't configured correctly.

1. Ran the below mentioned following commands:
stsadm -o getproperty -pn portalsuperuseraccount -url https://mysites.url.com/
stsadm -o getproperty -pn portalsuperreaderaccount -url https://mysites.url.com/

Above commands returned below output:
<Property Exist="Yes" Value="superuser"/>
<Property Exist="Yes" Value="superreader”/>

Did you notice that it was not of the format "domain\username”. This was the issue

2. Remove existing
I ran the below commands to remove the existing values set for the super user & superreader using below power shell command:
$wa = Get-SPWebApplication "https://mysites.url.com"
$wa.Properties.Remove("portalsuperuseraccount")
$wa.Properties.Remove("portalsuperreaderaccount")
$wa.update()

3. Verify
After this, I verified the status using below power shell commands:
stsadm -o getproperty -pn portalsuperuseraccount -url https://mysites.url.com/
stsadm -o getproperty -pn portalsuperreaderaccount -url https://mysites.url.com/

This returned below value for super user & superreader:
<Property Exists="No" />PS C:\Users\ domain\superuser >
<Property Exists="No" />PS C:\Users\ domain\superreader>

4. Add new
Then I ran the command to set new values for the super user & superreader using below power shell commands:
$wa = Get-SPWebApplication " https://mysites.url.com"
$wa.Properties["portalsuperuseraccount"] = " domain\superuser "
$wa.Properties["portalsuperreaderaccount"] = " domain\superreader"
$wa.update()




Event ID 6398 and 5586 : Could not find stored procedure 'dbo.Search_GetRecentStats'.

Issue Description

On checking the SharePoint server event viewer, I was seeing the below errors every minute.

Event 6398
The Execute method of job definition Microsoft.Office.Server.Search.Monitoring.HealthStatUpdateJobDefinition (ID 67ac9b25-4559-4847-849f-16f05cee73c9) threw an exception. More information is included below.
Could not find stored procedure 'dbo.Search_GetRecentStats'.



Event 5586
Unknown SQL Exception 2812 occurred. Additional error information from SQL Server is included below.
Could not find stored procedure 'dbo.Search_GetRecentStats'.



Fix

Go to Central Administration -> Monitoring -> Configure usage and health data collection -> Enable health data collection

Tuesday, April 7, 2015

Backup a SharePoint Site

Backup SharePoint Site
Backup-SPSite http://sitename -Path E:\Backup\site_name.bak

NAME
    Backup-SPSite

SYNOPSIS
    Performs a backup of a site collection.

SYNTAX
    Backup-SPSite [-Identity] <SPSitePipeBind> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-NoSiteLock <SwitchParameter>] [-UseSqlSnapshot <SwitchParameter>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

DESCRIPTION

The Backup-SPSite cmdlet performs a backup of the site collection when the Identity parameter is used. By default, the site collection will be set to read-only for the duration of the backup to reduce the potential for user activity during the backup operation to corrupt the backup. 

Restore a SharePoint site to a specific database

Restore a SharePoint site
Restore-SPSite http://sitename -Path "E:\Backup\file.bak" -Force

Restore a SharePoint site to a specific database

Restore-SPSite http://sitename -Path "E:\Backup\file.bak" -Force -DatabaseName "Database"

NAME
    Restore-SPSite

SYNOPSIS
    Restores a site collection.

SYNTAX
  Restore-SPSite [-Identity] <String> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-ContentDatabase <SPContentDatabasePipeBind>] [-Force <SwitchParameter>] [-GradualDelete <SwitchParameter>] [-HostHeaderWebApplication <String>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

Restore-SPSite [-Identity] <String> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DatabaseName <String>] [-DatabaseServer <String>] [-Force <SwitchParameter>] [-GradualDelete<SwitchParameter>] [-HostHeaderWebApplication <String>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

DESCRIPTION

The Restore-SPSite cmdlet performs a restoration of the site collection to a location specified by the Identity parameter. A content database may only contain one copy of a site collection. If a site collection is backed up and restored to a different URL location within the same Web application, an additional content database must be available to hold the restored copy of the site collection.

SharePoint Solution deployment stuck on deploying

Problem description

I was deploying the solution in our production environment and faced some strange issue.The status never changes from deploying.

Fix

1.  Log on to all the SharePoint servers in the farm -> Start -> Run -> services.msc 


2.   Check for SharePoint Timer service and make sure it’s in started mode. (This service should be started on all the web servers  as well as application server)

How to Remove a site collection Normally and Forcefully

To Remove a site collection Normally

Remove-SPSite "http://sitename/"

Apparently, the Remove-SPSite cmdlet cannot delete a site collection which is not fully provisioned, and this cmdlet doesn’t have a force flag.

To forcefully delete a site collection, use the SPContentDatabase.ForceDeleteSite method

$siteUrl = "http://sitename/"
$site = get-spsite $siteUrl
$siteId = $site.Id
$siteDatabase = $site.ContentDatabase
$siteDatabase.ForceDeleteSite($siteId, $false, $false)

Wednesday, March 25, 2015

For more information about this error navigate to the report server on the local server machine, or enable remote errors

Issue Description

I was getting the below error on a SharePoint page which had SQL Server Reporting Services Report Viewer web part on it
For more information about this error navigate to the report server on the local server machine, or enable remote errors

Fix

Enable Remote Errors for a SharePoint Site

1. In Site Actions click Site Settings for the site you want to modify.
2. Click Reporting Services Site Settings in the Reporting Services group.
3. Click Enable remote errors in local mode.
4. Click OK.

Thursday, March 12, 2015

SharePoint 2010 and Co-Authoring

Co-authoring simplifies collaboration by enabling multiple users to work productively on the same document without intruding on one another’s work or locking one another out. This functionality requires no additional server setup and is the default state for documents stored in SharePoint 2010.

Co-authoring is easy to use from the end user’s point of view. When a user wants to work on a document in Word 2010, PowerPoint 2010, or OneNote 2010, he or she merely opens it from SharePoint , as usual. If another user already has the document open, both users are able to edit the document at the same time; access to the document is not blocked and no error appears
In Word 2010 and PowerPoint 2010, saving to a document notifies other users viewing the document that there are new edits. Those users can refresh their view immediately to see those changes or continue their work and refresh later to see the latest edits. The authors can also see one another’s work, and everyone knows who is working on the document. SharePoint 2010 versioning and tracking tools protect the document so that authors can roll back unwanted changes.

Note:
  • When a user checks out a document for editing, this locks the document for editing to only that user, which prevents co-authoring. Require Check Out should not be enabled in document libraries where co-authoring will be used. By default, Require Check Out is not enabled in SharePoint 2010. Users should not check out documents manually when co-authoring is being used.
  • To collaborate best in PowerPoint and Word, we recommend that all users work with Office 2010


How to do this
1 Open document from SharePoint

2. Open from local client - > Edit

3. Enter your credentials

And start making changes..








Tuesday, March 10, 2015

SharePoint 2010 User Profile Synchronization connection missing

Issue Description

Last week, while I was checking the User Profile Settings in my Sharepoint 2010 farm and I noticed that on browsing to

User Profile Service Application -> Synchronization -> Configure Synchronization Connections 
-> My Synchronization Connection was empty.

I swear I have that it was always there, but below is the error message I saw

The query returns nothing.



Resolution

1. Go to Run -> services.msc

2. I checked for the service Forefront Identity Manager Services. It was not in Started state



3. Right click and Start it.



This should fix the issue.The Synchronization Connection should show up now


Monday, March 2, 2015

List of all SharePoint custom solutions and deployed web applications in the farm

      I was working on getting all the custom solutions in the farm. This could be obtained from the Central Administration. (Central Administration -> System Settings -> Manage farm solutions)

I wanted this list of solutions and also the web applications where they were deployed. I worked with a friend and came up with a PowerShell script to do this. This will definitely save you some time.

PowerShell Script

$File = "E:\SolutionandDeployedWebApplications.txt"
foreach ($solution in Get-SPsolution)
{
echo $solution.Name | Out-File $File -Append
echo $solution.DeployedWebApplications | Format-Table -Property Url | Out-File $File -Append

}