zondag 12 oktober 2008

MOSS: Label policy – how does it really work

The policies in MOSS allow you to add some document management functionality to MOSS. For example you can specify a label policy to ensure a certain label is always added to your document. But how does this work?

When saving a document to a document library, or when creating a new document from a document library the server adds the policy information to the file. Note, the file must be Word 2007 docx file (2003 doc file should also work, I will test this). The following information is added to the docx.

In the customXml folder of the unzipped word document we find the file item2.xml:

<?mso-contentType?>
<p:Policy xmlns:p="office.server.policy" id="" local="true">
<p:Name>Document</p:Name>
<p:Description>Mypolicy desc</p:Description>
<p:Statement>Label mypolicy</p:Statement>
<p:PolicyItems>
<p:PolicyItem featureId="Microsoft.Office.RecordsManagement.PolicyFeatures.PolicyLabel">
<p:Name>Labels</p:Name>
<p:Description>Generates labels that can be inserted in Microsoft Office documents to ensure that document properties or other important information are included when documents are printed. Labels can also be used to search for documents.</p:Description>
<p:CustomData>
<label>
<event type="save"/>
<event type="print"/>
<segment type="literal">MyPolicy</segment>
</label>
</p:CustomData>
</p:PolicyItem>
</p:PolicyItems>
</p:Policy>

and item5.xml



<?xml version="1.0" encoding="utf-8"?>
<p:properties xmlns:p="http://schemas.microsoft.com/office/2006/metadata/properties" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<documentManagement>
<DLCPolicyLabelLock xmlns="4d54d727-23fa-4efe-b6bd-38291cb8f05e" xsi:nil="true"/>
<DLCPolicyLabelClientValue xmlns="4d54d727-23fa-4efe-b6bd-38291cb8f05e">MyPolicy</DLCPolicyLabelClientValue>
<DLCPolicyLabelValue xmlns="4d54d727-23fa-4efe-b6bd-38291cb8f05e">MyPolicy</DLCPolicyLabelValue>
</documentManagement>
</p:properties>

So the policy rules are included in the document it self.  The policy I added was myPolicy. Note the label policy does not work with the watermark functionality :(. I guess you can write a “Watermark” policy using the same strategy.

Geen opmerkingen: