zoukankan      html  css  js  c++  java
  • [转]Adding a custom action to the MOSS expiration policy

    Adding a custom action to the MOSS expiration policy

    Office SharePoint 2007 out of the box has a policy framework, that can help with information management in your organization. On of the out of the box policies is the expiration policy. You can setup a policy for a site collection, content type of SharePoint List that will expire your item after a certain number of days, months or years after one of the date field values in your item. You can expire all whitepapers for example 5 years after they have been last modified.
    expire1

    The action to SharePoint will perform when the item expires depends on you, Out of the box there are 2 options: The items is deleted or a workflow is started. If a workflow is available for the content type or list, it will be listed in the dropdown.
    expire2

    It is also possible to create your own actions. After you have created and registered your action, it will show up in the “Perform this action” dropdown in the screenshot above.

    Step 1 – Implement the interface

    To create a custom action, you need to implement the IExpirationAction interface that can be found in the namespace Microsoft.Office.RecordsManagement.Features.

        public class ExpirationSendWarning : IExpirationAction 
        {
            public void OnExpiration(Microsoft.SharePoint.SPListItem item, 
                System.Xml.XmlNode parametersData, DateTime expiredDate)
            {
                // Do whatever you need to do with you item when it expires
            }
        }

    You need to put this in a strong named assembly and add it to the GAC.

    Step 2 – Create the registration xml

    After creating the expiration action, you need to register it by creating an xml file. You will find an example below. The featureId attribute of the PolicyResource element is important. This needs to be the ID of the out of the box expiration policy. The rest is pretty clear.  Save this xml to a file called “actionmanifest.xml”

        <?xml version="1.0" encoding="utf-8" ?>
        <p:PolicyResource id="TST.POC.PolicyFeatures.ExpirationSendWarning"
              featureId="Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration"
              type="Action"  xmlns:p="urn:schemas-microsoft-com:office:server:policy">
          <p:LocalizationResources>dlccore</p:LocalizationResources>
          <p:Name>ExpirationSendWarning</p:Name>
          <p:Description>Sends a warning on the reminder date</p:Description>
          <p:Publisher>Ton Stegeman</p:Publisher>
          <p:AssemblyName>
            TST.POC.PolicyOfTruth, Version=1.0.0.0, Culture=neutral,
            PublicKeyToken=503edd7b21a430b3
          </p:AssemblyName>
          <p:ClassName>TST.POC.PolicyFeatures.ExpirationSendWarning</p:ClassName>
        </p:PolicyResource>

    Step 3 – Register the expiration action

    The last step is to register the action. To do that, you run the example piece of code below from any type of application you like best:

        string actionmanifest = System.IO.File.ReadAllText("actionmanifest.xml");
        PolicyResourceCollection.Add(actionmanifest);

    The PolicyResourceCollection can be found in the namespace “Microsoft.Office.RecordsManagement.InformationPolicy”. Both for step 1 and 3 you need a reference to Microsoft.Office.Policy.dll

  • 相关阅读:
    软退回和硬退回的区别和联系
    十家国内知名的EDM服务提供商
    2018年第一记:EDM策略分享-EDM营销的策略分析
    分享几个目前研究出来的邮件不进垃圾箱技巧
    如何快速增加邮件列表用户数量
    EDM数据营销之电商篇| 六大事务性邮件,环环相扣打造极致用户体验!
    如何整合线上和线下营销进行深度交融
    品牌logo在EDM数据营销中的运用
    2017年内容营销如何提高ROI转化率
    营销必读:2017移动应用的五大营销趋势
  • 原文地址:https://www.cnblogs.com/frankzye/p/1801535.html
Copyright © 2011-2022 走看看