Permission.ApplyPolicy Method

Applies a policy to the form using a policy template file.

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

Syntax

'Declaration
Sub ApplyPolicy ( _
    bstrFileName As String _
)
'Usage
Dim instance As Permission
Dim bstrFileName As String

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

Parameters

  • bstrFileName
    Type: System.String

    The path and file name of an Extensible Rights Markup Language (XRML) file that defines users and groups and permissions to apply to the form template.

Remarks

To view an example of the format of an XRML file that is used as a policy template file, see Sample End-User License in the Rights Management Services SDK.

Because the Permission object and its members are new to Microsoft InfoPath 2010, 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 Microsoft.Office.Interop.InfoPath.SemiTrust 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.

Examples

In the following example, the ApplyPolicy method is used to apply a policy template file that allows the user to edit, but not copy the current form.

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

See Also

Reference

Permission Interface

Permission Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace