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' 
      <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> 

    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'   
            <formula id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Formula.BuiltIn'>  
            <action id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Action.MoveToRecycleBin' /> 
            <schd>weekly between sun 12:15:00 and sun 16:30:00</schd> 
          <p:ResourceType id='DateCalculator' required='false'>  
            <p:Name>Expiration Date Calculator</p:Name> 
          <p:ResourceType id='Action' required='false'>  
            <p:Name>Expiration Action</p:Name> 

    So .. anyone got any ideas?

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



    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!

    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