Permission.ApplyPolicy 方法

使用策略模板文件将策略应用于表单。

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

语法

声明
Sub ApplyPolicy ( _
    bstrFileName As String _
)
用法
Dim instance As Permission
Dim bstrFileName As String

instance.ApplyPolicy(bstrFileName)
void ApplyPolicy(
    string bstrFileName
)

参数

  • bstrFileName
    类型:System.String

    定义用户和组以及权限(将应用于表单模板)的可扩展权限标记语言 (XRML) 文件的路径和文件名。

备注

若要查看用作策略模板文件的 XRML 文件的格式示例,请参阅 Rights Management Services SDK 中的 Sample End-User License(该链接可能指向英文页面)(最终用户许可示例)。

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

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

示例

在以下示例中,将使用 ApplyPolicy 方法应用允许用户编辑、但不允许用户复制当前表单的策略模板文件。

_XDocument3 thisDoc = (_XDocument3)thisXDocument;
thisDoc.Permission.ApplyPolicy(
   "\\\\MyShare\\Templates\\Edit_but_not_copy.xml");
Dim thisDoc As _XDocument3 = DirectCast(thisXDocument, _XDocument3)
thisDoc.Permission.ApplyPolicy( _
   "\\MyShare\Templates\Edit_but_not_copy.xml")

另请参阅

引用

Permission 接口

Permission 成员

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