locked
Invalid elements in a PolicyFeature definition RRS feed

  • Question

  • I'm trying to write my own custom Management Policy.

    I've got most of it working (timer job definition, feature receivers and event handlers), but having trouble with the PolicyFeature xml file for the configuration settings.

    According to the MOSS 2007 SDK I can use ConfigPage and GlobalConfigPage elements to specify a URL to an ASCX control.

    Unfortunately, when I try to do this I get the following error message:

    The element 'PolicyFeature' in namespace 'urn:schemas-microsoft-com:office:server:policy' has invalid child element 'ConfigPage' in namespace 'urn:schemas-microsoft-com:office:server:policy'. List of possible elements expected: 'ResourceTypes' in namespace 'urn:schemas-microsoft-com:office:server:policy'.

    My Policy Feature is as follows:

    <p:PolicyFeature id='ManagementPolicies.NotificationPolicyFeature' 
                     group='Policy' 
                     xmlns:p='urn:schemas-microsoft-com:office:server:policy'>  
      <p:Name>Notification Policy</p:Name> 
      <p:Description>A policy which will send email notifications to users when an item is due to expire. The notification date can be provided through a formula.</p:Description> 
      <p:Publisher>REMOVED</p:Publisher> 
      <p:AssemblyName>REMOVED</p:AssemblyName> 
      <p:ClassName>REMOVED</p:ClassName> 
      <p:ConfigPage>NotificationSettings.ascx</p:ConfigPage> 
      <p:GlobalConfigPage>globalnotificationsettings.ascx</p:GlobalConfigPage> 
    </p:PolicyFeature> 


    I have checked the out of the box "Expiration" policy, and it has a policy feature manifest of:

    <p:PolicyFeature id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration'   
                       xmlns:p='urn:schemas-microsoft-com:office:server:policy'   
                       group='Policy'>  
        <p:LocalizationResources>dlccore</p:LocalizationResources> 
        <p:Name>$Resources:PolicyFeature_Expiration_Name</p:Name> 
        <p:Description>$Resources:PolicyFeature_Expiration_Description</p:Description> 
        <p:Publisher>$Resources:PolicyFeature_Any_Publisher</p:Publisher> 
        <p:ConfigPage>retentionsettings.ascx</p:ConfigPage> 
        <p:ConfigPageInstructions>$Resources:PolicyFeature_Expiration_Instructions</p:ConfigPageInstructions> 
        <p:DefaultCustomData> 
          <data> 
            <formula id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Formula.BuiltIn'>  
              <number>7</number> 
              <property>Modified</property> 
              <period>months</period> 
            </formula> 
            <action id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Action.MoveToRecycleBin' /> 
          </data> 
        </p:DefaultCustomData> 
        <p:GlobalConfigPage>retentionglobalsettings.ascx</p:GlobalConfigPage> 
        <p:GlobalCustomData> 
          <data> 
            <auto>true</auto> 
            <schd>weekly between sun 12:15:00 and sun 16:30:00</schd> 
          </data> 
        </p:GlobalCustomData> 
        <p:ClassName>Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration</p:ClassName> 
        <p:ResourceTypes> 
          <p:ResourceType id='DateCalculator' required='false'>  
            <p:Name>Expiration Date Calculator</p:Name> 
          </p:ResourceType> 
          <p:ResourceType id='Action' required='false'>  
            <p:Name>Expiration Action</p:Name> 
          </p:ResourceType> 
        </p:ResourceTypes> 
      </p:PolicyFeature> 


    So .. anyone got any ideas?


    regards
    Martin Hatch
    MCPD .Net Web Development
    MCTS WSS 3.0 | MOSS 2007
    Visit my Blog
    Thursday, January 22, 2009 1:03 PM

Answers

  •  

    Nailed it ... the end result?

     

    The XSD Schema (which I managed to disassemble from the internal Microsoft.Office.RecordsManagement.InformationPolicy.PolicyFeatureSchema class, using .Net Reflector) apparently states that ... the elements have to be in a certain order.

     

    You can guarantee that a knowledgebase article of some kind will follow this, but for now the order of elements MUST BE:

     

    ·         PolicyFeature (@id, @group)

    o   Name

    o   Description

    o   Publisher

    o   ConfigPage

    o   ConfigPageInstructions

    o   DefaultCustomData

    o   GlobalConfigPage

    o   GlobalCustomData

    o   AssemblyName

    o   ClassName

     

    You can leave elements out, but try to put them in any other order than the one above and you will get an error message (like the one below).

     

    C’est la vie!


    regards
    Martin Hatch
    MCPD .Net Web Development
    MCTS WSS 3.0 | MOSS 2007
    Visit my Blog
    • Marked as answer by Martin Hatch Friday, January 23, 2009 12:17 PM
    Friday, January 23, 2009 12:17 PM