Issue creating subsites when a built-in field is modified


One of our site collections in a migration to SharePoint 2013 experienced an issue with creating sub sites:

Sorry, something went wrong
The URL 'SitePages/Home.aspx' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.

Drilling down in the ULS logs we noticed these:

System.Runtime.InteropServices.COMException: <nativehr>0x81020030</nativehr><nativestack></nativestack>The URL 'SitePages/Home.aspx' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web., StackTrace:  
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)   
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)   
at Microsoft.SharePoint.Utilities.SPUtility.ProvisionWikiPageHomePage(SPFile wikiPage)   
at Microsoft.SharePoint.Utilities.SPUtility.EnsureWikiPageHomePage(SPWeb web, ProvisionWikiPage provisionWikiPage)   
at Microsoft.SharePoint.SPWikiPageHomePageFeatureReceiver.FeatureActivated(SPFeatureReceiverProperties properties)   
at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)   
at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce)

System.Data.SqlClient.SqlException (0x80131904): Parameter '@tp_Author' was supplied multiple times.   
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)   
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)   
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)   
at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)   
at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)   
at System.Data.SqlClient.SqlDataReader.TryNextResult(Boolean& more)   
at System.Data.SqlClient.SqlDataReader.NextResult()   
at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)   
at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)  ClientConnectionId:1237a76d-2050-4ad5-82cd-cc9610f95061

The tp_Author gave an entry point into troubleshooting this issue. A quick loop through the fields on the web and then looking for ColName="tp_Author" revealed only the out of the box “Author” field being present. But it was modified at some point in history because the Group was different and there was a Version attribute present.

One can quickly test this behaviour on a clean new site collection and updating the field with powershell:

$w = Get-SPWeb http://intranet
$f = $w.Fields.GetFieldByInternalName("Author")
$f.Update()

The schema xml will look as follows:

<Field ID="{1df5e554-ec7e-46a6-901d-d85a3881cb18}" Name="Author" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Author" Group="_Hidden" ColName="tp_Author" RowOrdinal="0" Type="User" List="UserInfo" DisplayName="Created By" Sealed="FALSE" ReadOnly="TRUE" Version="1" />

And also it will now be impossible to create any sites in the site collection (exception is the ‘blank’ site but it has the same issues once you activate the “Wiki page home page” feature and edit/save a page).

Solution

Luckily the product team has provided a method named Microsoft.SharePoint.SPField.RevertCustomizations() that will undo the changes and restore the site creation functionality.

$f.RevertCustomizations()
HTH
 


Links to this post

Comments

Monday, 30 Jun 2014 04:23 by Kevin Pelkmans
Nice solution!

Tuesday, 27 Jan 2015 04:54 by Walace
Thanks!

Friday, 13 Feb 2015 01:02 by Peter Holpar
Hi Steven, thanks for the advice, we had the same issue when wanted to create an English subsite in a German site collection. However, in our case there were not customizations to the field at all (no Version attribute, no other Group, seemed no difference in SchemXml after RevertCustomizations), and after fixing the Author field, we had to repeat the process for the Editor field as well. Thanks again! Regards, Peter

Sunday, 1 Mar 2015 09:34 by Matas Nizamovas
Thank you, very useful!

Tuesday, 19 May 2015 12:18 by Dirk Bauer
Perfekt, works after many hours of digging in other stuff! Thanks

Tuesday, 1 Dec 2015 02:40 by Christin
Many thanks! This Blog-Entry saved a lot of my time!

Friday, 19 Feb 2016 06:07 by Pete
This looks like the fix I am after, however I have issue with the powershell command.... SPweb doesn't work. Do you mean SPsite for a site collection? Also, where is the schema xml? Cheers!

Tuesday, 23 Feb 2016 11:27 by Steven Van de Craen
Hi Pete, it is definitely SPWeb but your URL might be different of course. What issue are you getting? Are you using the correct URL? You can view the SchemaXml using youField.SchemaXml (https://msdn.microsoft.com/EN-US/library/office/microsoft.sharepoint.spfield.schemaxml.aspx)

Tuesday, 22 Aug 2017 10:55 by Arnold
I am still having an issue creating my subsite even after using this suggested fix. I am still getting the smae error. Anyone to help?

Thursday, 24 Aug 2017 10:57 by Steven Van de Craen
Hi Arnold, What does your ULS log say? Is it the tp_Author or could it be another field? Cheers

CAPTCHA Image Validation