Niels Ziegler
Guest
|
I have experience with Add-In Express for Word, but this is my first outlook addin.
First, I need to get a reference to the current e-mail object. I found one in the "new inspector" event (currentItem), but I am still searching in the ExplorerSelectionChange event. This must have been discussed before, but I was unable to achieve success with what I have (https://www.add-in-express.com/forum/read.php?FID=5&TID=7743). Could you maybe point me to a blog post or working example to handle the currently selected mail item using C#? VB would also work.
Secondly, even if I have an active mail item, I am wondering if it is possible to set a mail property to "encrypted", as the button "Encrypt" in the Options Tab on new mails does, after clicking another ribbon button to evaluate some conditions. I could not find any reference to such a property. I am wondering, if this is one of those cases where the object model does not allow access and I will have to use something like redemption. |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Hello Niels,
On how to handle ExplorerSelectionChange, check my code at https://www.add-in-express.com/forum/read.php?PAGEN_1=3&FID=5&TID=13430.
#2. Are you using a built-in or custom button to encrypt the email? You can "click" the built-in button programmatically: get Inspector.CommandBars, and call CommandBars.ExecuteMso(%idMso of the button/toggleButton to click%). I suppose the IdMso of the built-in button in your case is "EncryptMessage".
Andrei Smolin
Add-in Express Team Leader |
|
Niels Ziegler
Guest
|
To close this topic, I used the following snippet I found on a MSDN forum to set sign and encrypt options for the current mail item:
string PR_SECURITY_FLAGS = @"http://schemas.microsoft.com/mapi/proptag/0x6E010003";
int ulFlags = 0;
ulFlags = ulFlags | 0x1; // Add the encrypted flag
ulFlags = ulFlags | 0x2; // Add the signed flag
selectedMail.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS, ulFlags);
selectedMail.Save(); |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Thank you, Niels!
Andrei Smolin
Add-in Express Team Leader |
|