Office SharePoint Server 2007 shipped with a powerful new document management feature called "Information Management Policies". Information management policies can be applied to both content types and document libraries. Information management policies are a set of rules and each rule is considered a policy feature. Below is a list of available policy features in Office SharePoint Server 2007:
These policies are exposed to Office 2007 clients. For example, if a policy includes a label feature that requires that a label be inserted when saving your document to SharePoint then the user is prompted. Labels can be very useful when printing documents. Legally required metadata can be printed strategically within the document using the label feature in a policy. This post will show you how to integrate label and barcode features into your own SharePoint aware application such as PDF or TIFF document viewers using the SharePoint object model.
Label Policy Feature You can define a label feature for content type by defining a site collection policy from the "site collection policies" link in the site settings page of a site collection. Check the "Enable Labels" section and you can define your label. In the label format box you can type a literal value followed by a dynamic value in brackets. The dynamic value in brackets must be a name of a column within the content type you intend to associate with the label. In the appearance section you can set the font, size, style, and justification of how you want the label printed.
In order to make your applications policy aware you will have to obtain the policy for a document when you load it. This can be done via the Microsoft.Office.Policy assembly located in the GAC on the Office SharePoint 2007 server. using Microsoft.Office.RecordsManagement.InformationPolicy; using (SPSite site = new SPSite(documentUrl)) { using (SPWeb web = site.OpenWeb()) { SPFile docFile = web.GetFile(documentUrl); Policy docPolicy = Policy.GetPolicy(docFile.Item.ContentType); PolicyItem docPolicyItem = docPolicy.Items["Microsoft.Office.RecordsManagement.PolicyFeatures.PolicyLabel"]; return docPolicyItem.CustomData; }} The Policy object contains a default PolicyItemCollection containing PolicyItems. The key to the collection is a string which can be one of the following:
Note: This collection is case sensitive so it must be typed in exactly as listed above in order to get the item. Each PolicyItem's CustomData property will return a chunk of xml listing information you can use to implement SharePoint information management features. For instance, if you need information on including a label on a document before it is printed you can obtain this from the CustomData property as shown below:
Here the policy feature calls for a label to be printed with a width of 2 inches, a height of 2 inches and an Arial font. The label will also include the literal "Managed By:" and a "metadata" segment where you are to pull the column value for Title and incorporate it into the label. You don't need to worry about the value because it can be obtained from the SPFile's DLCPolicyLabelValue property.
As you can see the value for the DLCPolicyLabelValue property has the Literal and the metadata value for "Title" merged together. This value is generated when the document is uploaded or updated in SharePoint. You now have all the information you need to add a label to the document before printing.
BarCode Policy Feature Another useful policy feature in Office SharePoint Server 2007 is BarCodes. BarCodes can be added to a document prior to printing in order to uniquely identify the document. For instance, if you upload a document into SharePoint and then print it with a barcode, then you can use the barcode value to search for the document in SharePoint. In the case of a document that needs to be printed and signed by a customer, then the document could be scanned again via a document imaging solution and automatically updated using the barcode value. You can use the same code listed above to get the xml from the CustomData property of the PolicyItem object but it will only return "<barcode/>". There is nothing in the CustomData to help you implement this policy feature. Fortunately there are three properties of the SPFile object you can use to help you implement this feature:
The _dlcBarCodeImage property contains the Base64 encoded image of the barcode that you can use to add to the document before printing. The _dlc_BarCodePreview contains a comma delimited string with the first value being a url to the preview of the image and the second value a string value with "BarCode: xxxxxxxxxx". The "xxxxxxxxxx" represents the unique 10 number that is assigned to the document when it is uploaded. The url can be used to provide a preview of the image before adding it to the document. Finally, the _dlc_BarCodeValue represents the unique 10 digit id for the document and can be used to find the document via a metadata search when scanning the document back into SharePoint. Note: Please beware that after you have associated a policy with a content type and then make changes to the policy, the changes will not be reflected within the contentType until you un-associate and re-associate the policy with the content type. In addition, the label value will only be updated after policy changes if the item is updated. Information Management Policy is new to SharePoint but not to the world of Document Management. Office SharePoint Server 2007 has added many new Document Management capabilities your applications can take advantage of.
|
1 comment:
Interesting article. We have been using barcodes and routing sheets for a while and they really simplify the whole process.
Steve
PSIGEN SharePoint Document Imaging
Post a Comment