SignatureObject 介面
表示已新增至表單或表單中已簽章資料集的數位簽章。
**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)
語法
'宣告
<GuidAttribute("096CD718-0786-11D1-95FA-0080C78EE3BB")> _
<CoClassAttribute(GetType(SignatureObjectClass))> _
Public Interface SignatureObject
Inherits Signature
'用途
Dim instance As SignatureObject
[GuidAttribute("096CD718-0786-11D1-95FA-0080C78EE3BB")]
[CoClassAttribute(typeof(SignatureObjectClass))]
public interface SignatureObject : Signature
備註
此類型為 coclass 的包裝函式,屬於 COM 互通性中 Managed 程式碼的必要項。使用此類型,即可存取由此 coclass 實作的 COM 介面成員。如需 COM 介面 (包括其成員說明連結) 的詳細資訊,請參閱 Signature。
使用 SignaturesCollection 集合的 Item 屬性,傳回 Signature 物件。
範例
在下列範例中,使用 Signature 物件的 Status 屬性,判斷簽章的狀態,並在訊息方塊中顯示數個 Signature 物件屬性:
public void DisplaySignatureProperties()
{
SignatureObject mySignature = thisXDocument.SignedDataBlocks[0].Signatures[0];
CertificateObject signatureCertificate = mySignature.Certificate;
string signatureComment = mySignature.Comment;
IXMLDOMNode signatureNode = mySignature.SignatureBlockXmlNode;
string signatureStatus = "Unknown";
switch(mySignature.Status)
{
case XdSignatureStatus.xdSignatureStatusValid :
signatureStatus = "Valid";
break;
case XdSignatureStatus.xdSignatureStatusInvalid :
signatureStatus = "Invalid";
break;
case XdSignatureStatus.xdSignatureStatusError :
signatureStatus = "Error";
break;
case XdSignatureStatus.xdSignatureStatusUnsupported :
signatureStatus = "Unsupported";
break;
}
thisXDocument.UI.Alert("Signature properties:\n Status = " + signatureStatus + "\n Comment = " + signatureComment + "\n Certificate Issued To = " + signatureCertificate.IssuedTo);
thisXDocument.UI.Alert("Digital signature XML block: \n" + signatureNode.xml);
}