Share via


Permission.Enabled Property

Gets or sets whether the permission settings represented by the Permission object are enabled for the current form.

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

Syntax

'Declaration
Property Enabled As Boolean
    Get
    Set
'Usage
Dim instance As Permission
Dim value As Boolean

value = instance.Enabled

instance.Enabled = value
bool Enabled { get; set; }

Property Value

Type: System.Boolean
true if the permission settings are enabled; otherwise false.

Remarks

Use the Enabled property to determine whether permissions are restricted on the active form, and to enable or disable permissions. Set Enabled to false to disable permissions and to remove all users, other than the form author, and their permissions.

Note

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 message "The property/method is not available in preview mode" is returned.

Because the Permission object and its members are new to Microsoft InfoPath 2010, you must cast the object returned by the thisXDocument variable to the _XDocument3 type to access this object and its members. For more information, see How to: Use Microsoft.Office.Interop.InfoPath.SemiTrust Members That Are Not Compatible with InfoPath 2003.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Examples

In the following example, the Enabled property is used to display whether permission settings are enabled for the current form.

_XDocument3 thisDoc = (_XDocument3)thisXDocument;
thisXDocument.UI.Alert(thisDoc.Permission.Enabled.ToString());
Dim thisDoc As _XDocument3 = DirectCast(thisXDocument, _XDocument3)
thisXDocument.UI.Alert(thisDoc.Permission..Enabled.ToString())

See Also

Reference

Permission Interface

Permission Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace