Monthly Archives: July 2011

Post Migration – This page is not using a valid page layout


In case of publishing sites, when you export and import sites, the pages will throw “This page is not using a valid page layout” error.
This is due to the fact that PublishingPageLayout is hardcoded within the page itself and must be updated on the migrated site. If you want to investigate further, download the page and check for the value.

In my case, I was restoring a site collection (http://sharepoint/sites/ASITE/) as a subsite (http://sharepoint/ASITE/)using powershell (syntax below for example).

Export-SPWeb -Identity http://sharepoint/sites/ASITE/ -Path C:\Temp\ASITE.01.bak -IncludeUserSecurity -IncludeVersions All
Import-spweb -Identity http://sharepoint/ASITE/ -Path C:\Temp\ASITE.01.bak -IncludeUserSecurity -ActivateSolutions

The site http://sharepoint/sites/ASITE/ would work fine but this error would be at http://sharepoint/ASITE/

The PageLayout needs to be updated for all pages in the new site. There are many posts about doing this via powershell, and here is how mine looked like. Update the “WelcomeLinks” to suit your needs.

$spWeb = Get-SPWeb -Identity "http://sharepoint/ASITE/"
$spPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($spWeb)
$pages = $spPubWeb.PagesList
foreach($item in $pages.Items)
{
$pubPage = [Microsoft.SharePoint.Publishing.PublishingPage]::GetPublishingPage($item)
$url = new-object Microsoft.SharePoint.SPFieldUrlValue($pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout].ToString())
if($url -ne $null)
{
$itemPage =$url.Url
write-host $itemPage
if($itemPage -match'WelcomeLinks')
{
$newurl = new-object Microsoft.SharePoint.SPFieldUrlValue("http://sharepoint/_catalogs/masterpage/WelcomeLinks.aspx, Welcome page with summary links")
$pubPage.Name
$pubPage.CheckOut()
$pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout] = $newurl
$pubPage.ListItem.UpdateOverwriteVersion()
$pubPage.ListItem.File.CheckIn("Fixed PageLayout URL", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn);
}
}
}
Advertisements

SharePoint Calendar Overlay AND Filtering


Scenario

You have upto 10 calendars that need to be “overlayed” as one single calendar. Pretty easy – create a new Calendar and simply use the “Calendars Overlay” to get the other 10 calendars.

What if only certain items were to be filtered for, and displayed in the top Overlay Calendar?

Calendar Overlay

Easy 

  1. Create views for the individual calendars, based on the “Calendar” view, apply filters as necessary – this is a new View
  2. Goto the top “Overlay Calendar” and edit the child calendar to show the newly created view

SharePoint 24 Hour Calendar Display


The default SharePoint Calendar Day / Week view will not show a 24 hour calendar display. You will need to change the Site Regional Settings for this change to take place.

Using Powershell

$web = "http://sp/"
$spSite = [Microsoft.SharePoint.SPSite]($web)
$spWeb = $spSite.OpenWeb()
$spWeb.RegionalSettings.WorkDayStartHour = 360
$spWeb.RegionalSettings.WorkDayEndHour = 1080
$spWeb.Update()

The values for WorkDayStartHour and WorkDayEndHour are expressed in minutes from 12:00 AM

6AM = 6 x 60 = 360
6PM = 18 x 60 = 1080

Using GUI

Site > Site Settings > Regional Settings : Define Your Work Week

Disappearing Domain Accounts when adding Domain Account as Local Administrators


Story – Creating a new local lab environment using VMware Workstation for Guest OS Windows Server 2008 R2 with SP1.

I created a Domain Controller SERVER-A and created some domain service accounts (svc-A) that were to be used as Administrators on member servers.

After attaching a new guest SERVER-B as a domain computer, I tried adding the svc-A account under the local administrators group. It would let me add the account, but as soon as I added (and applied), the svc-A account would disappear from the local Administrators group.

OK.

So I try to add that account again – and – error – “Account svc-A is already a member of this group”

Culprit – my sysprep process. For Windows Server 2008 R2, I did not check the “Generalize” option, and that would not create a new SID for the member server.

I had to check the “Generalize” option, which then creates a new SID, which then allows me to add and view a domain account under local administrators for that member server.