Attach digital Signature with code

  • Thread starter Thread starter andyoye
  • Start date Start date
A

andyoye

I have a button on a win form that launches outlook and auto populates To:,
Subject:, Attachment:.... How can I attach digital signature so when users
click the button, it attaches their signatures.

Code Sample:

Outlook.Application outlookApp = new Outlook.Application();

Outlook.MailItem message =
(Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);

message.Subject = attachName;

message.To = msgTo;...............

Thanks
 
There's nothing in the Outlook object model that supports digital signing.
If the users have a command bar button or ribbon control for signing you
could call the Execute method on that control to sign but that's about it.
 
How can I can call execute method on them? We do have command bar
button/ribbon control.
 
You get that button (CommandBarButton) object, which has an Execute method.
You will need the ID for the CommandBarButton, to use with the Find method
to instantiate that button. You can use a tool such as OutlookSpy
(www.dimastr.com) to open an Inspector viewer on an open Inspector and then
go to the CommandBars tab to find your button ID. I believe there's also a
list of some ID's at www.outlookcode.com and sample code there to get ID's.
I don't use a signing certificate for my emails so I don't know that ID
myself.

For ribbon controls you would use the ribbon XML references to find the
idMso for that control in the type of Inspector you want to deal with (for
example mail compose) and once you have that you can use the
CommandBars.ExecuteMso method with the idMso to execute the ribbon control.
 
Back
Top