5

I am trying to provision sites using SharePoint 2013 Client-side Object Model (CSOM) via SharePoint apps. I get the exception below when the method context.ExecuteQuery() is executed. Has anyone come across this exception before? Any info on troubleshooting this issue is highly appreciated!

Sample Code

// Add a publishing site
WebCreationInformation newWebInfo = new WebCreationInformation();
newWebInfo.Description = "Some description";
newWebInfo.Title = "Some title";
newWebInfo.WebTemplate = "BLANKINTERNET#0";
newWebInfo.UseSamePermissionsAsParentSite = true;
newWebInfo.Url = "Some url";

newWeb = web.Webs.Add(newWebInfo);
web.Update();
context.ExecuteQuery();

Stack trace:

Provisioning did not succeed. Details: Failed to initialize some site properties for Web at Url: 'http://area51.latham.com/News' OriginalException: A cobalt error was thrown.

at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery() at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery() at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() at .CreateSubSiteTree(Web web, XmlNode node) in :line 44 at .ProvisionSites(Uri appWebUrl, String configListName, Boolean& handleErrors) in :line 368

ULS log:

Event log message was: 'Failed to initialize some site properties for Web at Url: . Exception was: 'Microsoft.SharePoint.SPException: A cobalt error was thrown. ---> System.Runtime.InteropServices.COMException: 0xa0cb0028A cobalt error was thrown.
at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int64 cbFile, Object punkSPFileMgr, Object punkFFM, Int64 PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, String bstrLockIdMatch, String bstEtagToMatch, Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock, Int32 bValidateReqFields, Guid gNewDocId, SPFileSaveParams sfsp, SPFileInfo& pFileProps, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagReturn, Byte& piLevel, Int32& pbIgnoredReqProps)
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int64 cbFile, Object punkSPFileMgr, Object punkFFM, Int64 PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, String bstrLockIdMatch, String bstEtagToMatch, Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock, Int32 bValidateReqFields, Guid gNewDocId, SPFileSaveParams sfsp, SPFileInfo& pFileProps, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagReturn, Byte& piLevel, Int32& pbIgnoredReqProps) - -- End of inner exception stack trace ---
at Microsoft.SharePoint.SPFile.SaveBinaryInternal(Stream file, Int64 fileSizeToSave, SPFileStreamManager spmgr, Boolean isBackgroundSave, String checkInComment, Boolean checkRequiredFields, Boolean autoCheckoutOnInvalidData, Boolean bIsMigrate, Boolean bIsPublish, Boolean bForceCreateVersion, String lockIdMatch, SPUser modifiedBy, DateTime timeLastModified, Object varProperties, SPFileFragmentPartition partitionToCheck, SPFileFragmentId fragmentIdToCheck, SPFileFragmentPartition[] fragPartitionsToDelete, String csvPartsToDelete, Stream formatMetadata, String etagToMatch, Boolean bSyncUpdate, SPLockType lockType, String lockId, TimeSpan lockTimeout, Boolean refreshLock, Boolean requireWebFilePermissions, Boolean failIfRequiredCheckout, Boolean validateReqFields, Guid newDocId, Boolean bypassMaxFileCheck, Boolean bypassQuotaCheck, Boolean bypassVirusScan, SPVirusCheckStatus newVirusStatus, Int32 newVirusVendorId, String newVirusInfo, Byte[] newVirusInfoEx, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage, String& etagReturn, Boolean& ignoredRequiredProps, SPFileInfo& fileProps)
at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, SPFileSaveBinaryParameters parameters)
at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, Boolean checkRequiredFields, Boolean createVersion, String etagMatch, String lockIdMatch, Stream fileFormatMetaInfo, Boolean requireWebFilePermissions, String& etagNew)
at Microsoft.SharePoint.SPFile.SaveBinary(Byte[] file)
at Microsoft.SharePoint.Publishing.Mobile.MappingsFile1.<>c__DisplayClassc.<UpdateFile>b__a(SPSite elevatedSite)
at Microsoft.SharePoint.Publishing.CommonUtilities.<>c__DisplayClass1.<RunWithElevatedSite>b__0()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Publishing.Mobile.MappingsFile
1.UpdateFile(Dictionary2 mappingsToBeSaved)
at Microsoft.SharePoint.Publishing.Mobile.MappingsFile
1.Update(Dictionary2 mappingsToBeUpdated, Boolean forceOverwrite)
at Microsoft.SharePoint.Publishing.CustomMasterUrlProperty.SetDirectChannelSpecificValue(SPWeb web)
at Microsoft.SharePoint.Publishing.CustomMasterUrlProperty.SetDirectValue(String value, SPWeb web)
at Microsoft.SharePoint.Publishing.InheritableProperty
1.SetValue(TValueType value, Boolean forceAllSubWebInherit, String successUrl, String failureUrl)
at Microsoft.SharePoint.Publishing.InheritableProperty`1.SetValue(TValueType value, Boolean forceAllSubWebInherit)
at Microsoft.SharePoint.Publishing.Internal.AreaProvisioner.SetMasterPageProperties(PublishingWeb area, Boolean& updateRequired)
at Microsoft.SharePoint.Publishing.Internal.AreaProvisioner.SetLayoutRelatedProperties(PublishingWeb area, Boolean& updateRequired)
at Microsoft.SharePoint.Publishing.Internal.AreaProvisioner.InitializePublishingWebDefaults()'

1

The problem has been solved now. At least in our situation...

We were deleting the sites (we provisioned during app install) in app uninstalling event handler as part of the clean-up process. I observed that if we do not empty the web's recycle bin after we delete the sub webs by calling web.RecycleBin.DeleteAll(); method, the code above throws the exception mentioned when run immediately after uninstall. The code above is executed in app installed event handler.

I am not sure if this is intended behavior in SharePoint 2013 CSOM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.