UserPermission.Permission 属性
获取或设置代表当前表单的权限的值,这些权限已分配给与 UserPermission 对象关联的用户。
命名空间: Microsoft.Office.Interop.InfoPath.SemiTrust
程序集: Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)
语法
声明
Property Permission As Integer
Get
Set
用法
Dim instance As UserPermission
Dim value As Integer
value = instance.Permission
instance.Permission = value
int Permission { get; set; }
属性值
类型:System.Int32
与 MsoPermission 枚举值之一对应的整数值。
备注
由于 Microsoft InfoPath 无法识别 UserPermission 对象及其成员,因此您必须将 thisXDocument 变量返回的对象强制转换成 _XDocument3 类型,才能访问此对象及其成员。有关详细信息,请参阅如何:使用与 InfoPath 2003 不兼容的 Microsoft.Office.Interop.InfoPath.SemiTrust 成员。
此成员只能由与当前打开的表单在相同域中运行的表单访问,或者由已授予跨域权限的表单访问。
示例
在以下示例中,将从表单的 Permission 集合中检索与电子邮件地址"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;
UserPermission thisUser = thisDoc.Permission["someone@example.com"];
thisUser.Permission =
(int)MsoPermission.msoPermissionChange;
Dim thisDoc As _XDocument3 = DirectCast(thisXDocument, _XDocument3)
Dim thisUser As UserPermission = _
thisDoc.Permission["someone@example.com"];
thisUser.Permission = _
DirectCast(MsoPermission.msoPermissionChange, Integer)