Permission.Item 属性

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

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
ReadOnly Default Property Item ( _
    varIndex As Object _
) As UserPermission
    Get
用法
Dim instance As Permission
Dim varIndex As Object
Dim value As UserPermission

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

参数

  • varIndex
    类型:System.Object

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

属性值

类型:Microsoft.Office.Interop.InfoPath.SemiTrust.UserPermission
一个代表指定用户的 UserPermission 对象。如果指定的 varIndex 不存在,则返回 空引用(无 在 Visual Basic 中)。

备注

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

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

示例

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

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

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

_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 接口

Permission 成员

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间