Permission.Item[Object] 属性

定义

获取指定 UserPermission 索引处的对象。

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

参数

varIndex
Object

Permission 集合中 UserPermission 对象的数值索引,或要返回其当前表单权限集合的用户的电子邮件地址。

属性值

一个 UserPermission 表示指定用户的 对象。 如果指定的 varIndex 不存在,则返回一个 null 引用 (Visual Basic) 中 Nothing。

示例

在以下示例中,Item 属性用于获取与电子邮件地址“”someone@example.com关联的用户的 UserPermission 对象,然后使用 PermissionUserPermission 对象的 属性将用户的权限设置为“更改访问级别”。

若要访问用于设置权限的 MsoPermission 枚举值,必须使用 Visual Studio 2012 中“添加引用”对话框 的 COM 选项卡 设置对 Microsoft Office 14.0 对象库的引用。 这将建立对 Microsoft.Office.Core 命名空间成员的引用。

此示例要求在表单模块的声明节中对 Microsoft.Office.Core 命名空间使用 usingImports 指令。

_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)

注解

由于 Permission 对象及其成员对 Microsoft InfoPath 不熟悉,因此必须将 thisXDocument 变量返回的对象强制转换为 _XDocument3 类型才能访问此对象及其成员。 有关详细信息,请参阅如何:使用与 InfoPath 2003 不兼容的对象模型成员。

此成员只能由与当前打开的表单在相同域中运行的表单访问,或者由已授予跨域权限的表单访问。

适用于