UserPermission.Permission Property
Gets or sets a value representing the permissions on the current form assigned to the user associated with a UserPermission object.
Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)
Syntax
'Declaration
Property Permission As Integer
Get
Set
'Usage
Dim instance As UserPermission
Dim value As Integer
value = instance.Permission
instance.Permission = value
int Permission { get; set; }
Property Value
Type: System.Int32
An integer value that corresponds to one of the MsoPermission enumeration values.
Remarks
Because the UserPermission 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 user associated with the e-mail address "someone@example.com" is retrieved from the Permission collection of the form and assigned to a UserPermission object. Then, the Permission property of the UserPermission object is used to set that user's permissions to the Change access level.
To access the MsoPermission enumeration values for setting permissions, you must set a reference to the Microsoft Office 14.0 Object Library using COM tab of the Add Reference dialog box in Microsoft Visual Studio Tools for Applications. This will establish a reference to the members of the Microsoft.Office.Core namespace.
This example requires a using or Imports directive for the Microsoft.Office.Core namespace in the declarations section of the form module.
_XDocument3 thisDoc = (_XDocument3)thisXDocument;
UserPermission thisUser = thisDoc.Permission["someone@example.com"];
thisUser.Permission =
(int)MsoPermission.msoPermissionChange;
Dim thisDoc As _XDocument3 = DirectCast(thisXDocument, _XDocument3)
Dim thisUser As UserPermission = _
thisDoc.Permission["someone@example.com"];
thisUser.Permission = _
DirectCast(MsoPermission.msoPermissionChange, Integer)