Share via


Permission class

Provides access to the UserPermissionCollection and permission settings that can be applied to a form.

Inheritance hierarchy

System.Object
  Microsoft.Office.InfoPath.Permission

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustInherit Class Permission
'Usage
Dim instance As Permission
public abstract class Permission

Remarks

Use the Permission class and its members to restrict permissions to the active form and to get or set specific permissions settings.

An instance of the Permission class associated with a form template is returned by the Permission() property of the XmlForm class. The returned Permission object provides access to the collection of UserPermission objects associated with the form template and each form instance created with that template. Each UserPermission object is used to define a specific set of rights for an individual user. While some permissions granted through the user interface apply to all users, you can use the UserPermission object to assign permission on a per-user basis with per-user expiration dates.

The Permission object and its properties and methods are available whether permissions are restricted on the active form template or not. Use the Enabled property to determine whether a form has restricted permissions.

If the Windows Rights Management client is not installed on a user's computer, using the Permission class raises an exception.

Permissions on a form are enabled in one of the following ways by using properties and methods of the Permission class:

The Enabled property is set to true.

The DocumentAuthor property is set.

The RequestPermissionUrl property is set.

The StoreLicenses property is set to true or false.

The ApplyPolicy method is called.

Permissions on a form can also be enabled by using one of the Add methods of the UserPermissionCollection class to add a user to the form's user permissions collection.

Note

Permissions cannot be applied when a form is in preview mode. For this reason, all of the properties of the Permission class are read-only when a form is being previewed. In preview mode, the Enabled property will always return false, and if code attempts to change this setting, a System.Runtime.InteropServices.COMException is raised and the error "The property/method is not available in preview mode" is returned. Similarly, the properties and methods associated with the UserPermission and UserPermissionCollection classes will also return this error message when used in preview mode.

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

Permission members

Microsoft.Office.InfoPath namespace