Getting access denied while create a site collection policy and then add this policy to a content type RRS feed

  • Question

  • I have created a feature with Site scope and on feature activated event, I am creating xml Expiration Formula and validate it 


    It works ok. It validates but while adding  PolicyResourceCollection.Add(xmlExpirationFormula); It is giving error as access denied.

    Expiration Policy couldn't be added: Access denied. -    at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()
       at Microsoft.Office.RecordsManagement.InformationPolicy.PolicyResourceCollection.Add(PolicyConfigService service, Boolean fDeferredUpdate, String xmlManifest)
       at Microsoft.Office.RecordsManagement.InformationPolicy.PolicyResourceCollection.Add(String xmlManifest)
       at ClosingCockpit.Tools.Features.ExpirationMail.ExpirationMailEventReceiver.<>c__DisplayClass2.<FeatureActivated>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 ClosingCockpit.Tools.Features.ExpirationMail.ExpirationMailEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)

    Am I missing something? What are the rights require for adding policy?

    Friday, March 24, 2017 1:01 PM

All replies

  • Perhaps you do not have 'Site Policy' feature activated in the target site collection. Include 'Site Policy' feature as a dependency for your custom feature to ensure the order of the feature activation.

    Please, mark as answer, if this helps.

    Saturday, March 25, 2017 12:32 PM
  • Hi B2ZSP,

    Any update about Vadim's suggestion?

    Best regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Monday, March 27, 2017 2:53 AM
  • Site Policy feature is activated by default and then we are deploying our WSP on it. 

    Just to add, It works in my local development environment ,I believe user is same (app pool identity and user who is activating feature).

    If I login with different user and activate feature I could reproduced this issue. After reproducing this issue I have elevate scope of the feature to Web Application level then this issue is resolved. However in my production environment ,we can not create web application feature as per client guide line. 

    Please help!!!

    Monday, March 27, 2017 6:38 AM