共用方式為


SignEventObject 介面

OnSign 事件期間使用的事件物件。

**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)

語法

'宣告
<CoClassAttribute(GetType(SignEventObjectClass))> _
<GuidAttribute("096CD71D-0786-11D1-95FA-0080C78EE3BB")> _
Public Interface SignEventObject
    Inherits SignEvent
'用途
Dim instance As SignEventObject
[CoClassAttribute(typeof(SignEventObjectClass))] 
[GuidAttribute("096CD71D-0786-11D1-95FA-0080C78EE3BB")] 
public interface SignEventObject : SignEvent

備註

此類型為 coclass 的包裝函式,屬於 COM 互通性中 Managed 程式碼的必要項。使用此類型,即可存取由此 coclass 實作的 COM 介面成員。如需 COM 介面 (包括其成員說明連結) 的詳細資訊,請參閱 SignEvent

使用 SignedDataBlockObject 物件的 SignedDataBlock 屬性,判斷哪個可簽章的資料集觸發 OnSign 事件。OnSign 事件只能針對完全信任的表單範本進行自訂。

範例

在下列範例中,使用 SignEvent 物件新增簽章及時間戳記至 SignedDataBlockObject 物件:

public void OnSign(SignEvent e)
{
    Signature signature = e.SignedDataBlock.Signatures.Create();
    signature.Sign();
    // Countersign the signature with a trusted timestamp.
    // Get the XML node storing the signature block.
    IXMLDOMNode oNodeSig = signature.SignatureBlockXmlNode;
    IXMLDOMNode oNodeSigValue = oNodeSig.selectSingleNode(".//*[local-name(.)=’signatureValue’]");
    // Get time stamp from timestamp service (fictitious).
    MyTrustedTimeStampingService s = new MyTrustedTimeStampingService();
    string strVerifiedTimeStamp = s.AddTimeStamp(oNodeSigValue.text);
 
    //Add the value returned from the timestamping service to the 
    //unsigned part of the signature block.
    IXMLDOMNode oNodeObj = oNodeSig.selectSingleNode(".//*[local-name(.)=’Object’]");
    IXMLDOMNode oNode = oNodeObj.cloneNode(false);
    oNode.text = strVerifiedTimeStamp;
    oNodeObj.parentNode.appendChild(oNode);
    e.ReturnStatus = true;
}

請參閱

參考

SignEventObject 成員
Microsoft.Office.Interop.InfoPath 命名空間