_XDocumentEventSink2_Event.OnSign event

Office 2013 and later

Occurs after a set of signed data has been selected to sign through the Digital Signature wizard.

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

event _XDocumentEventSink2_OnSignEventHandler OnSign

You can use the OnSign event to add additional data to the digital signature. For example, you can add data from a trusted timestamp server, or add a server-side countersignature of the transaction. You can also use the OnSign event to block signing if the current user is not a member of a particular group.

In the following example, created by adding the OnSign event to the form by selecting Programming from the Tools menu in the InfoPath designer user interface, a digital signature is added to the form by using the Sign method of the SignatureObject object:

public void OnSign(SignEvent e)
// The OnSign handler can be customized only in fully trusted form templates.
Signature thisSignature = e.SignedDataBlock.Signatures.Create();

// You can add other pieces of information to sign by modifying the signature
// template in thisSignature.SignatureBlockXmlNode.
e.ReturnStatus = true;