Modifica

Condividi tramite


Permission.Item[Object] Property

Definition

Gets the UserPermission object at the specified index.

public:
 property Microsoft::Office::Interop::InfoPath::UserPermissionObject ^ default[System::Object ^] { Microsoft::Office::Interop::InfoPath::UserPermissionObject ^ get(System::Object ^ varIndex); };
public Microsoft.Office.Interop.InfoPath.UserPermissionObject this[object varIndex] { get; }
member this.Item(obj) : Microsoft.Office.Interop.InfoPath.UserPermissionObject
Default Public ReadOnly Property Item(varIndex As Object) As UserPermissionObject

Parameters

varIndex
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

A UserPermission object that represents the specified user. Returns a null reference (Nothing in Visual Basic) if the specified varIndex does not exist.

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 or Visual Studio. 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)

Applies to