Accessing Classification Properties

Enumerating FSRM classification properties is easily done using the FsrmClassificationManager object.

All interfaces required to access and manage properties are defined in SrmLib.dll found in the System32 directory of Windows Server 2008 R2 and later. This library will have to be added as a reference to projects that attempt to interface with the classification infrastructure. All the relevant interfaces are in the Microsoft.Storage namespace.

Querying classification property definitions

Querying the classification property definitions on a server has to be done via APIs. It follows this pattern:

This snippet demonstrates enumerating classification properties.


$cls = New-Object -com Fsrm.FsrmClassificationManager
$cls.EnumPropertyDefinitions()

Retrieving a classification property by name

If the name of a property is known, the property definition can be retrieved using the GetPropertyDefinition method.

Note  This is the Name property of the property definition, not the DisplayName property.

This snippet demonstrates retrieving a classification property.


$cls = New-Object -com Fsrm.FsrmClassificationManager
$cls.GetPropertyDefinition("<Name>")

Retrieving classification properties on a file

To query the classification properties on a file there are two mechanisms available:

  • If the name of the property is known, the GetFileProperty method can be used to specify the exact property to get.

    Note  This is the Name property of the property definition, not the DisplayName property.

  • Otherwise, the EnumFileProperties method can retrieve all properties known for a file.

In either case, the mechanism to do this follows this pattern:

This snippet demonstrates retrieving classification properties on a file.


$cls = New-Object -com Fsrm.FsrmClassificationManager
$p = $cls.GetFileProperty("c:\data\data.txt", "<Name>", 0)
$c = $cls.EnumFileProperties("c:\data\data.txt", "<Name>", 1)

Setting a property on a file

Setting a property on a file is very similar using the SetFileProperty method.

Note  This is the Name property of the fille property, not the DisplayName property.

This snippet demonstrates setting a property on a file.


$cls = New-Object -com Fsrm.FsrmClassificationManager
$p = $cls.SetFileProperty("c:\data\data.txt", "<Name>", "<Value>")

Property type representations

Values for properties are always Unicode strings. The following conventions should be used when retrieving or setting classification properties:

Property TypeUnicode String Representation

String

Standard representation of value

Integer

Standard representation of value

Ordered List

Standard representation of value

Boolean

"1" for yes/true and "0" for no/false

Date

Standard representation of a decimal 64 bit FILETIME value

Multi-choice

Standard representation of values separated by '|'

Multi-string

Standard representation of values separated by '|'

 

Related topics

Using FSRM
FsrmClassificationManager
IFsrmClassificationManager
IFsrmClassificationManager::EnumFileProperties
IFsrmClassificationManager::EnumPropertyDefinitions
IFsrmClassificationManager::GetFileProperty
IFsrmClassificationManager::GetPropertyDefinition
IFsrmClassificationManager::SetFileProperty
IFsrmPropertyDefinition

 

 

Show:
© 2014 Microsoft