SignatureCollection.CreateSignature method

Creates a new Signature object without adding it to the form.

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

Syntax

'Declaration
Public MustOverride Function CreateSignature As Signature
'Usage
Dim instance As SignatureCollection
Dim returnValue As Signature

returnValue = instance.CreateSignature()
public abstract Signature CreateSignature()

Return value

Type: Microsoft.Office.InfoPath.Signature
A new Signature object that contains a snapshot of the view plus additional signature information.

Exceptions

Exception Condition
SecurityException

The form template is not configured for Full Trust using the Security and Trust category of the Form Options dialog box.

Remarks

The CreateSignature method creates a new signature (gets a snapshot of the view plus additional signature information) without adding the signature to the form. To add this signature to the form, you must call the Sign method of the Signature class.

The method can be called only from an event handler for the Sign event.

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

Examples

The following example shows the code skeleton that is added to the form template when you add an event handler for the Sign event. It uses the CreateSignature method to create a new Signature object. When the Sign method of the Signature class is called, the new Signature object is added to the SignatureCollection object of the form.

public void FormEvents_Sign(object sender, SignEventArgs e)
{
   // This event handler will run only in fully trusted form templates.

   Signature thisSignature = 
      e.SignedDataBlock.Signatures.CreateSignature();

   // To add other pieces of information to sign, modify the
   // signature template returned by
   // thisSignature.SignatureBlockXmlNode.
   // Write your code here.

   thisSignature.Sign();
   e.SignatureWizard = false;
}
Public Sub FormEvents_Sign(ByVal sender As Object, _
   ByVal e As SignEventArgs)

   ' This event handler will run only in fully trusted form templates.

   Dim thisSignature As Signature = _
      e.SignedDataBlock.Signatures.CreateSignature()

   ' To add other pieces of information to sign, modify the
   ' signature template returned by
   ' thisSignature.SignatureBlockXmlNode.
   ' Write your code here.

   thisSignature.Sign()
   e.SignatureWizard = False
End Sub

See also

Reference

SignatureCollection class

SignatureCollection members

Microsoft.Office.InfoPath namespace