Permission.Item[Object] Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the UserPermission object at the specified index.
public:
property Microsoft::Office::Interop::InfoPath::SemiTrust::UserPermission ^ default[System::Object ^] { Microsoft::Office::Interop::InfoPath::SemiTrust::UserPermission ^ get(System::Object ^ varIndex); };
public Microsoft.Office.Interop.InfoPath.SemiTrust.UserPermission this[object varIndex] { get; }
member this.Item(obj) : Microsoft.Office.Interop.InfoPath.SemiTrust.UserPermission
Default Public ReadOnly Property Item(varIndex As Object) As UserPermission
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. 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)
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 Object Model 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.