2

I'm dynamically creating custom retention actions for information management policies. My problem is that in the retention action dropdown menu, I would like to show only some custom retention actions - specifically, custom actions that were created within the scope of the content database for the current site collection (the one we're creating a policy for): enter image description here

Example:

  • if I'm creating a policy for a site collection that is stored in WSS_Content1 database, I would like to display 2 additional custom actions in the drop down, "Action_1" and "Action_2";
  • if I'm creating a policy for a site that is stored in WSS_Content2 database, I would like to display 3 additional custom actions in the drop down, "Action_X", "Action_Y", "Action_Z".

Right now, I use PolicyResourceCollection.Add(policyXml); to register a policy action. This works fine, except that no matter what site collection I'm creating a policy for, all registered (farm wide?) actions appear in the drop down. In the previous example this means that I will always see 5 actions, "Action 1", "Action 2", "Action_X", "Action_Y" and "Action_Z".

Is there a way I can achieve this, i.e. only show some custom policies in the drop down or ideally register them in some scoped way?

My policy action xml looks roughly like this:

<?xml version="1.0" encoding="utf-8" ?>
<p:PolicyResource id="ID01234"
                  featureId="Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration" type="Action"
                  xmlns:p="urn:schemas-microsoft-com:office:server:policy">  
  <p:Name>$OPERATION_NAME$</p:Name>
  <p:Description>...</p:Description>
  <p:Publisher>PublisherName</p:Publisher>
  <p:AssemblyName>MyAssembly.RetentionAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b04c63c6e5e66367</p:AssemblyName>
  <p:ClassName>MyAssembly.RetentionAction.Callback</p:ClassName>
</p:PolicyResource>

$OPERATION_NAME$ is replaced programatically prior to adding policy action.

One thing that works is modification of the code that populates the drop down (i.e. filter the options), but this produces an unsupported SharePoint state.

  • sharepoint.stackexchange.com/questions/2597/… have you seen this ? Seems to be hardcoded in JavaScript. – Cameron Verhelst Jul 15 '14 at 9:27
  • That was for 2007. Creating custom actions is not a problem (at least not in 2010 and 2013), but limiting what actions are displayed to the user is. – w128 Jul 15 '14 at 9:32
  • That's what the linked article in there says. So you would have to find a way to inject JS or customize the page (not recommended). The best way for me seems to be to redirect to a customized version of that page. – Cameron Verhelst Jul 15 '14 at 9:38

Your Answer

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

Browse other questions tagged or ask your own question.