_XDocumentEventSink2_Event.OnSign 事件
在通过"数字签名"向导选定一组已签名数据用于签名之后发生。
命名空间: Microsoft.Office.Interop.InfoPath.SemiTrust
程序集: Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)
语法
声明
Event OnSign As _XDocumentEventSink2_OnSignEventHandler
用法
Dim instance As _XDocumentEventSink2_Event
Dim handler As _XDocumentEventSink2_OnSignEventHandler
AddHandler instance.OnSign, handler
event _XDocumentEventSink2_OnSignEventHandler OnSign
备注
可以使用 OnSign 事件将其他数据添加到数字签名中。例如,可以添加受信任时间戳服务器中的数据,也可以添加事务的服务器端副署。如果当前用户不是特定组的成员,还可以使用 OnSign 事件阻止签名。
示例
在 InfoPath 设计器用户界面的"工具"菜单中选择"编程",将 OnSign 事件添加到表单,从而创建以下示例,其中,使用 SignatureObject 对象的 Sign 方法将数字签名添加到表单:
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.
thisSignature.Sign();
e.ReturnStatus = true;
}