Cannot Create a subsite based on Publishing Site template or unable to enable publishing feature on a site.
Whenever we try to create a subsite based on publishing template or try to activate the publishing feature it fails with the following error:
Provisioning did not succeed. Details:Failed to initialize some site properties for Web at Url: '<url>'OriginalException: <nativehr>0x80070002</nativehr><nativestack></nativestack>
In ULS we see the following error
Failed to initialize some site propertiesfor Web
atUrl: '<url>'. Exception was: 'System.IO.FileNotFoundException:<nativehr>0x80070002</nativehr><nativestack>owssvr.dll:(unresolved symbol, module offset=000000000000BBA9)
at0x000007FEE9BBBBA9 owssvr.dll: (unresolved symbol, moduleoffset=0000000000039A84)
at0x000007FEE9BE9A84 mscorwks.dll: (unresolved symbol, moduleoffset=00000000002BE757)
at0x000007FEF3BDE757 Microsoft.SharePoint.Library.ni.dll: (unresolved symbol,module offset=00000000000DD779)
at0x000007FEEC53D779 Microsoft.SharePoint.ni.dll: (unresolved symbol, moduleoffset=0000000001AA810E)
at0x000007FEEE52810E Microsoft.SharePoint.ni.dll: (unresolved symbol, moduleoffset=0000000001A754D2)
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
atMicrosoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType,Object& pvarFileOrFolder)
atMicrosoft.SharePoint.Publishing.Internal.Store.GetListByUrl(SPWeb web, StringlistUrlName)
Above stack is quite generic and doesn’t really give any information about the specific file or the library that its looking for.
While trying to activate the features SP was looking for default lists and libraries that are created when we activate the publishing infrastructure feature on a site collection.
# Another symptom that we noticed while troubleshooting was the SharePoint Publishing Infrastructure feature was throwing the same error when we try to deactivate, which indicated that this feature which is dependent feature for publishing feature got some issue. To further narrow it down we tried deactivating the individual features one by one using powershell.
Disable-spfeature navigation -url -force Disable-spfeature publishinglayouts -url -force
Disable-spfeature publishingweb -url -force (activating on root site level)
Disable-spfeature publishingSite -url -force (activating on site collectionlevel)
Disable-spfeature publishingresources -url -force -- this gave an error
Disable-spfeature publishing .xml -url -force
# It gave the same stack while deactivating the publishingresource feature, so now we have narrowed it down to this feature.
# Since stack was indicating some missing file, we resorted to comparing the libraries that gets created when we activate the publishingsite feature on a site collection.
# We found that on our ill-fated site following libraries were missing
2.Site collection documents
3.Site collection images
# We exported these 3 libraries using stsadm –o export –url and imported it on our site.
# Deactivated and activated the publishing infrastructure feature through GUI and bingo, everything started working as expected
This helps my problem creating publishing sites using powershell.