IMetabaseDeviceDescriptor.DeviceName

Syntax

DeviceName: String;

Description

The DeviceName property returns the device name.

Comments

The property is used if limit mode is set for the printers used for printing.

Example

To execute the example, add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MP: IMetabasePolicy;
    DP: IMetabaseDevicePolicy;
    DevDess: IMetabaseDeviceDescriptors;
    Users: IMetabaseUsers;
    User: IMetabaseUser;
    Printers: IMetabaseDeviceDescriptors;
    DevDes: IMetabaseDeviceDescriptor;
    Category: ISecurityCategory;
    Desc: ISecurityDescriptor;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    MP := MS.Policy;
    DP := MP.PrintersPolicy;
    DevDess := DP.Enumerate;
    Users := MS.Users;
    User := Users.Administrator;
    Printers := User.Printers;
    
Try
        DevDess.Add(
"printserver1\Microsoft Office Document Image Writer");
        DevDes := DevDess.Add(
"printserver2\snagit 8");
    
Except On e: Exception Do
        WinApplication.InformationBox(e.Message);
    
End Try;
    Desc := DevDes.SecurityDescriptor;
    Desc.Edit;
    Category := MP.MandatoryAccess.Category(
0);
    Desc.AccessToken.ClassificationLabel(Category) := Category.Level(
1);
    Desc.Apply(
False);
    Printers.Add(DevDes.DeviceName);
    MS.Apply;
    Lic := 
Null;
End Sub UserProc;

After executing the example, two printers are added to the security policy, one of them is added to the list of administrator printers available for printing with security level on.

See also:

IMetabaseDeviceDescriptor