The Page Layout Button is Disabled on the Ribbon

SharePoint 2010 has a bug on the ribbon for the publishing site. In some pages the Page Layouts button is disabled on the ribbon.

A simple workaround for this can be found at http://erikswenson.blogspot.com/2011/05/page-layout-this-control-is-currently.html:

-Check the page out and edit it.

-Click on the Save and Close dropdown and select Save and Keep Editing.

-After the page is refreshed you will see the Page Layouts button enabled.

Thanks Erik Swenson! It helped me a lot!!

 

See you,

Amadeu.

How to Check if your SharePoint 2010 Web Application Uses Claims Authentication

Sometimes, depending on the number of web applications and environments you manage, it can be hard to find out which web applications use claims authentication.

One simple way to check if your web application is using claims authentication is to run the following Powershell script:

$web = Get-SPWebApplication “<URL for Application>”
$web.UseClaimsAuthentication

 

See you,

Amadeu.

 

Powershell to Enable SharePoint 2010 Developer Dashboard

Today’s post is just a simple Powershell script to enable the Developer Dashboard:

$dd = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$dd.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On;
$dd.RequiredPermissions = ‘EmptyMask’;
$dd.TraceEnabled = $true;
$dd.Update();

See you,
Amadeu.

Unexpected System.NullReferenceException After Restoring a SharePoint 2010 Content Database

After a user deleted lots of permissions on a SharePoint site we decided to ask for a restore of the content database in order to solve the issue.

Everything was fine, we had all the backups, we knew the time the user deleted the permission assignments and the had the downtime window to restore the backup.

The restore process went fast and fine, the database has been restored and I attached it back to SharePoint.

I tested the site on one of the WFE servers and it looked great, but when I went to the second load balanced server I got the following error message:

Unexpected System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.SharePoint.SPSite.PreinitializeServer(SPRequest request)
at Microsoft.SharePoint.SPWeb.InitializeSPRequest()
at Microsoft.SharePoint.WebControls.SPControl.EnsureSPWebRequest(SPWeb web)
at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)
at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.GetContextWeb(HttpContext context)
at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostResolveRequestCacheHandler(Object oSender, EventArgs ea)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& complet…

It didn’t make any sense. Why only one of the servers was not working?

I tried the regular debug approach but none of the actions worked:

  • Restart the application pool.
  • Reboot the server.
  • Attach and dettach the content database.

I also tried to connect to the SPWeb using Powershell and it worked on one server and didn’t work on the other one.

I went then to Google to research a little bit and after several false positive articles, I found this article explaining the issue (thank you very much Giles!!!):

http://ghamson.wordpress.com/2011/10/28/sharepoint-web-front-end-http-404-response-but-no-errors-in-the-log-sp2010-ps2010-msproject-projectserver-in/#comment-429

SharePoint has a configuration cache and if it is not cleared you can have this kind of issue.

Follow the steps to solve the issue:

  1. Stop the OWSTIMER service on the problem SharePoint WFE server in the farm.
  2. On the problem server, navigate to:

    Windows Server 2003 location: Drive:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config\GUID and delete all the XML files from the directory.
    Windows Server 2008 location: Drive:\ProgramData\Microsoft\SharePoint\Config\GUID and delete all the XML files from the directory.

  3. Delete all the XML files in the directory. NOTE: ONLY THE XML FILES, NOT THE .INI FILE.
  4. Open the cache.ini with Notepad and reset the number to 1. Save and close the file.
  5. Start the OWSTIMER service on the server and wait for XML files to begin to reappear in the directory.
  6. IIS Reset (optional) – you can just recycle the app pool and it will work.

 

Thanks @twlamb for the revision…..

See you,

Amadeu.

Powershell Script to Check Multiple Files In

Versioning is a very useful feature on document libraries but sometimes when you bulk load a bunch a files you might have a hard time checking it in. In my case I couldn’t disable versioning to upload the files, so I tweaked a script I had to check the files in. If you are in the same situation you may find it a time saver script.

Follow the Powershell script:

$web = Get-SPWeb -Identity “http://%5BSERVER NAME]/[SPWEB]”

$folderURL = “[DOCUMENT LIBRARY]/[FOLDER]”

function ProcessFolder {
param($folderUrl)
$folder = $web.GetFolder($folderUrl)
foreach ($file in $folder.Files) {
write-output $file.url
write-output $file.CheckOutStatus
if ($file.CheckOutStatus -ne “None”) {
$file.CheckIn(“”, [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
write-output “Checked file in”
}
}

foreach ($subfolder in $folder.SubFolders)
{
write-output $subfolder.Url
ProcessFolder($subfolder.Url)
}
}

ProcessFolder($folderURL)
 

See you,

Amadeu.