I have run into a site collection which couldn’t create a search site (they were trying to create one using the “Enterprise Search Center” template) although you could create one in the same sharepoint farm if you created a new site collection (based on the existing templates and even blank). The only obvious difference was the template they created the site collection from, which was the root of all evil.
Sharepoint was failing, throwing the typical “An unexpected error has occurred” message and then the Correlation ID to check the ULS logs. By the way you can dive into the ULS logs using this awesome tool that supports searching based on the correlation id etc (not to mention the built in sharepoint management capabilities it provides). Back to our problem, sharepoint has failed to prepare the site and I was able to retrieve the following error in the event viewer:
At this point I will spare you the details and give you the easy and proper way to fix this. Simply activate the “SharePoint Server Publishing Infrastructure” feature of the site collection (not the site!) and you should be ready to create a new search center.
Another, more hacky, way to do so is described in the following steps. The only reason I am writing about them is to hopefully give an insight on what’s really going on behind the scenes.
So, in order to solve the missing aspx files problem, you can either copy them from another site collection or do the proper solution of enabling the hidden feature PortalLayouts. This feature should have been enabled by default, but it seems that the original template was a very minimal one. To enable this features, you can use the sharepoint powershell and post the following command:
Trying once more to create the new site, you will get the same sharepoint error that will redirect you once more to the ULS logs (did I mention the lifesaving MOSS tools?) and a new exception in the event viewer. The error will be the same “failed to prepare site” but the exception will be the following:
Back to the list of master pages and yes, that list doesn’t contain the Title column either! Actually the list contains only the “Master Page” content type which doesn’t have the title field.
In order to add the required fields, you should make sure that the list contains at least the following content types:
This should solve your problem the hard way, since you didn’t pick the simple site collection feature activation.
Sharepoint was failing, throwing the typical “An unexpected error has occurred” message and then the Correlation ID to check the ULS logs. By the way you can dive into the ULS logs using this awesome tool that supports searching based on the correlation id etc (not to mention the built in sharepoint management capabilities it provides). Back to our problem, sharepoint has failed to prepare the site and I was able to retrieve the following error in the event viewer:
at Microsoft.SharePoint.Publishing.Internal.AreaProvisioner.ValidateAndExpandPageLayoutsString(String availablePageLayouts, String webLocaleName)The exception was System.ArgumentException as the AvailablePageLayouts parameter was pointing to an invalid url, ~SiteCollection/_catalogs/masterpage/searchmain.aspx. Based on that, I visited the master pages list (site actions-> site settings –> Master pages under the galleries categories) and to my surprise that list contained only the 3 default .master pages (default, minimal and v4)!
at Microsoft.SharePoint.Publishing.Internal.AreaProvisioner.InitializePublishingWebDefaults()
At this point I will spare you the details and give you the easy and proper way to fix this. Simply activate the “SharePoint Server Publishing Infrastructure” feature of the site collection (not the site!) and you should be ready to create a new search center.
Another, more hacky, way to do so is described in the following steps. The only reason I am writing about them is to hopefully give an insight on what’s really going on behind the scenes.
So, in order to solve the missing aspx files problem, you can either copy them from another site collection or do the proper solution of enabling the hidden feature PortalLayouts. This feature should have been enabled by default, but it seems that the original template was a very minimal one. To enable this features, you can use the sharepoint powershell and post the following command:
Enable-SPFeature -Identity PortalLayouts -url http://the/site/collection –forceBut wait, there is more as otherwise I wouldn’t have made such an intro.
Trying once more to create the new site, you will get the same sharepoint error that will redirect you once more to the ULS logs (did I mention the lifesaving MOSS tools?) and a new exception in the event viewer. The error will be the same “failed to prepare site” but the exception will be the following:
Exception was: 'System.InvalidOperationException: Failed to compare two elements in the array. ---> System.ArgumentException: The field name is not valid. {fa564e0f-0c70-4ab9-b863-0177e6ddd247} /sites/errorpronesitecollection/_catalogs/masterpageOk, so even if you are new to sharepoint, the field with id fa564e0f-0c70-4ab9-b863-0177e6ddd247 is Title which is one of the most common fields in sharepoint… How can this be NOT valid?
at Microsoft.SharePoint.SPFieldCollection.GetFieldById(Guid fieldId, Boolean bThrowException)
at Microsoft.SharePoint.SPListItem.get_Item(Guid fieldId)
at Microsoft.SharePoint.Publishing.PageLayout.get_Title()
at Microsoft.SharePoint.Publishing.PageLayout.get_UIDisplayName()
at Microsoft.SharePoint.Publishing.PageLayoutComparerByUIDisplayName.Compare(PageLayout x, PageLayout y)
at System.Collections.Generic.ArraySortHelper`1.SwapIfGreaterWithItems(T[] keys, IComparer`1 comparer, Int32 a, Int32 b)
at System.Collections.Generic.ArraySortHelper`1.QuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
--- End of inner exception stack trace ---
at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer)
at System.Array.Sort[T](T[] array, IComparer`1 comparer)
at Microsoft.SharePoint.Publishing.PublishingWeb.SetAvailablePageLayouts(PageLayout[] pageLayouts, Boolean resetAllSubsitesToInherit)
Back to the list of master pages and yes, that list doesn’t contain the Title column either! Actually the list contains only the “Master Page” content type which doesn’t have the title field.
In order to add the required fields, you should make sure that the list contains at least the following content types:
- Master page
- Page Layout
- Publishing Master Page
This should solve your problem the hard way, since you didn’t pick the simple site collection feature activation.
No comments:
Post a Comment