segunda-feira, 22 de dezembro de 2014

SharePoint 2013 - "The URL is invalid." na criação de subsites.


Os eventos abaixo ocorrem normalmente na criação de subsites caso que campos nativos foram modificados no pai do novo subsite.

1. O evento na interface do SharePoint:
Sorry, something went wrong The URL '<URL>/<SITE>.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.


2. No ULS: "The URL '<URL>/<SITE>.aspx' is invalid." 
System.Runtime.InteropServices.COMException: <nativehr>0x81020030</nativehr><nativestack></nativestack>The URL '<URL>/<SITE>.aspx' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder th   at 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)    

3. No ULS: "Parameter '@tp_Author' was supplied multiple times."
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)

O seguinte script identifica o campo a partir da coluna identificada "tp_author" no evento 3.
## informe o url do pai do novo subsite
$web = get-spweb "http://url/pai"
## informe a coluna identificada 
$web.fields | where-object {$_.schemaxml -like "*tp_author*"} | select title


Os desenvolvedores do SharePoint introduziram no SharePoint 2013 um novo método para esse caso - Microsoft.SharePoint.SPField.RevertCustomizations() que nós podemos utilizar para reverter as customizações em campos nativos:

($web.fields | where-object {$_.schemaxml -like "*tp_author*"}).RevertCustomizations()

Observação: Não utilize o método update para concluir a atualização, isso adicionaria a infomação (indesejada) da versão no schema do campo:



[] 

Nenhum comentário:

Postar um comentário