Share via


Permission.Item property

Gets the UserPermission object at the specified index.

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

Syntax

'Declaration
ReadOnly Default Property Item ( _
    varIndex As Object _
) As UserPermission
    Get
'Usage
Dim instance As Permission
Dim varIndex As Object
Dim value As UserPermission

value = instance(varIndex)
UserPermission this[
    Object varIndex
] { get; }

Parameters

  • varIndex
    Type: System.Object

    The numeric index of the UserPermission object in the Permission collection, or the email address of the user whose set of permissions on the current form is to be returned.

Property value

Type: Microsoft.Office.Interop.InfoPath.SemiTrust.UserPermission
A UserPermission object that represents the specified user. Returns a null reference (Nothing in Visual Basic) if the specified varIndex does not exist.

Remarks

Because the Permission object and its members are new to Microsoft InfoPath, 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 Item property is used to get the UserPermission object for the user associated with the e-mail address "someone@example.com", and then uses the Permission property of the UserPermission object 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 Visual Studio 2012. 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;
thisDoc.Permission["someone@example.com"].Permission = 
   (int)MsoPermission.msoPermissionChange;
Dim thisDoc As _XDocument3 = DirectCast(thisXDocument, _XDocument3)
thisDoc.Permission["someone@example.com"].Permission = _
   DirectCast(MsoPermission.msoPermissionChange, Integer)

See also

Reference

Permission interface

Permission members

Microsoft.Office.Interop.InfoPath.SemiTrust namespace