Thursday, April 24, 2014

How to properly deactivate publishing feature

In previous post, I mentioned that we should not disable "publishing feature" once it's enabled. Well, that's not true. After some investigation, I finally found how to disable it properly.

When we try to disable "SharePoint Server Publishing Infrastructure" from "Site Settings" page http://SharePointServer/sites/site1/_layouts/ManageFeatures.aspx?Scope=Site , we will see the error message "File Not Found." as displayed below:


From web page, it seems the feature is deactivated. However, if we check the ULS log, we can see the error messages which is listed at the end of this post.

How to fix it? Easier than what I initially thought.

1. Run the commands below to deactivate relevant features completely.

[updated, use PS to replace stsadm, 2014-11-17]

$url = "http://SharePointServer/sites/site1"

# aebc918d-b20f-4a11-a1db-9ed84d79c87e, PublishingResources
Disable-SPFeature –identity "PublishingResources" -URL $url -force -Confirm:$false

# f6924d36-2fa8-4f0b-b16d-06b7250180fa, SharePoint Server Publishing Infrastructure
Disable-SPFeature –identity "publishingSite" -URL $url -force -Confirm:$false

# 94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb, PublishingWeb, SharePoint Server Publishing
Disable-SPFeature –identity "publishingweb" -URL $url -force -Confirm:$false

# d3f51be2-38a8-4e44-ba84-940d35be1566, Page Layouts and Master Pages Pack
Disable-SPFeature –identity "PublishingLayouts" -URL $url -force -Confirm:$false

# 89e0306d-453b-4ec5-8d68-42067cdbf98e, Portal Navigation
Disable-SPFeature –identity "navigation" -URL $url -force -Confirm:$false

# 22a9ef51-737b-4ff2-9346-694633fe4416, Publishing Web Feature
Disable-SPFeature –identity "Publishing" -URL $url -force -Confirm:$false

From page "Site collection features" and "Site features", we can see the "Publishing" features are deactivated.




2. Delete the remnant of publishing feature

Open the site through SharePoint Designer, delete the highlighted folders and files from "/_catalogs/masterpage" as showed below.



3. Done.


[Update 2014-09-02]

May need to re-enable site collection features through PowerShell

# Fields
Disable-SPFeature -Identity "ca7bd552-10b1-4563-85b9-5ed1d39c962a" -confirm:$false -url $url
Enable-SPFeature -Identity "ca7bd552-10b1-4563-85b9-5ed1d39c962a" -confirm:$false -url $url

# CTypes
Disable-SPFeature -Identity "695b6570-a48b-4a8e-8ea5-26ea7fc1d162" -confirm:$false -url $url
Enable-SPFeature -Identity "695b6570-a48b-4a8e-8ea5-26ea7fc1d162" -confirm:$false -url $url

Then, delete list "ReusableContent" through "SharePoint Manager 2010", before enabling the site collection publishing feature.


Reference: 

http://www.sharepointchick.com/archive/2011/06/23/sharepoint-publishing-features-functionality.aspx


Error message when try to disable "SharePoint Server Publishing Infrastructure" through web page:

Unknown SPRequest error occurred. More information: 0x80070002

File Not Found: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Layouts\EditingMenu\SiteAction.xml

Publishing Resources Feature DeActivation failed. Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties).

Feature receiver assembly 'Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c', class 'Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler', method 'FeatureDeactivating' for feature 'aebc918d-b20f-4a11-a1db-9ed84d79c87e' threw an exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties)    
 at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)

Feature Deactivation: callout or unprovisioning elements threw an exception.  Feature 'PublishingResources' (ID: 'aebc918d-b20f-4a11-a1db-9ed84d79c87e').  Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties)    
 at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)    
 at Microsoft.SharePoint.SPFeature.Deactivate(SPSite siteParent, SPWeb webParent, Boolean fForce)

Feature Deactivation: Failed to deactivate the Feature 'PublishingResources' (id: 'aebc918d-b20f-4a11-a1db-9ed84d79c87e'), exception thrown: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties)    
 at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)    
 at Microsoft.SharePoint.SPFeature.Deactivate(SPSite siteParent, SPWeb webParent, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)

Exception was thrown while deactivating hidden dependency 'PublishingSite' (id: f6924d36-2fa8-4f0b-b16d-06b7250180fa) for feature 'PublishingResources' (id: aebc918d-b20f-4a11-a1db-9ed84d79c87e): System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties)    
 at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)    
 at Microsoft.SharePoint.SPFeature.Deactivate(SPSite siteParent, SPWeb webParent, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)    
 at Microsoft.SharePoint.SPFeatureCollection.DeactivateHiddenFeatureDependency(SPFeatureDefinition featdefDependant, SPFeatureDefinition featdefDependency, Boolean fForce)

Feature Deactivation: Failed to deactivate hidden dependencies for the Feature 'PublishingSite' (id: 'f6924d36-2fa8-4f0b-b16d-06b7250180fa'), exception thrown: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties)    
 at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)    
 at Microsoft.SharePoint.SPFeature.Deactivate(SPSite siteParent, SPWeb webParent, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)    
 at Microsoft.SharePoint.SPFeatureCollection.DeactivateHiddenFeatureDependency(SPFeatureDefinition featdefDependant, SPFeatureDefinition featdefDependency, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.DeactivateHiddenFeatureDependencies(SPFeatureDefinition featdefDependent, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)

System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)   
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)    
 at Microsoft.SharePoint.SPWeb.GetList(String strUrl)    
 at Microsoft.SharePoint.Publishing.CommonUtilities.GetDocLibByUrl(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.ProvisioningHelper.DeleteDocLibIfEmpty(SPWeb web, String webRelativeUrl)    
 at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.Unprovision()    
 at Microsoft.SharePoint.Publishing.PublishingResourcesFeatureHandler.FeatureDeactivating(SPFeatureReceiverProperties properties)    
 at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)    
 at Microsoft.SharePoint.SPFeature.Deactivate(SPSite siteParent, SPWeb webParent, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)    
 at Microsoft.SharePoint.SPFeatureCollection.DeactivateHiddenFeatureDependency(SPFeatureDefinition featdefDependant, SPFeatureDefinition featdefDependency, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.DeactivateHiddenFeatureDependencies(SPFeatureDefinition featdefDependent, Boolean fForce)    
 at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)    
 at Microsoft.SharePoint.ApplicationPages.DeactivateFeaturePage.LnkbtnDeactivateFeature_Click(Object objSender, EventArgs evtargs)    
 at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)    
 at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)    
 at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

No comments:

Post a Comment