How to avoid the outlook popup warning when retrieving an MailItem

M

Michael H

I managed to retrieve an MailItem successfully having the EntryID
ahead of time using:


olApplication = new ApplicationClass();
olNameSpace = this.olApplication.GetNamespace("MAPI");


MailItem item = (MailItem) this.olNameSpace.GetItemFromID(strEntryID,
null);

string retValue = item.Body;



Of course, the Outlook warning window pops up. I've switched to trying
Dmitry Streblechenko's Redemption.DLL but haven't figured out the
exact way to get the MailItem from a known MailItem.EntryID value.

Every single example I have found, so far, deals with "creating" an
EmailItem and then manipulating its fields/properties. This has proven
to be useless so far. I'll keep hacking away at this but don't know
which direction to head next.

Thanks,

Michael
 
K

Ken Slovak - [MVP - Outlook]

If MailItem is your Outlook mail item:

Dim safMail As Redemption.SafeMailItem

Set safMail = CreateObject("Redemption.SafeMailItem")
safMail.Item = MailItem

Setting safMail.Item assigns the MAPI object for the Outlook MailItem to the
Redemption SafeMailItem you create using CreateObject. From that point you
can access the properties and methods of the Redemption SafeMailitem.
 
M

Michael H

On Thu, 12 Jan 2006 09:45:29 -0500, "Ken Slovak - [MVP - Outlook]"

--> If MailItem is your Outlook mail item:
-->
--> Dim safMail As Redemption.SafeMailItem
-->
--> Set safMail = CreateObject("Redemption.SafeMailItem")
--> safMail.Item = MailItem
-->
--> Setting safMail.Item assigns the MAPI object for the Outlook
MailItem to the
--> Redemption SafeMailItem you create using CreateObject. From that
point you
--> can access the properties and methods of the Redemption
SafeMailitem.
-->
--> --
--> Ken Slovak
--> [MVP - Outlook]
--> http://www.slovaktech.com
--> Author: Absolute Beginner's Guide to Microsoft Office Outlook
2003
--> Reminder Manager, Extended Reminders, Attachment Options
--> http://www.slovaktech.com/products.htm


Ken,

Thanks for reply. The whole problem is getting the actual MailItem
object without the popup warning. The only value I have at my disposal
is Email.EntryID value which is returned from Windows Desktop Search.
Currently, I use this value to ask Outlook to return the EmailItem and
voilà the popup!


Michael
 
M

Michael H

--> Ken,
-->
--> Thanks for reply. The whole problem is getting the actual
MailItem
--> object without the popup warning. The only value I have at my
disposal
--> is Email.EntryID value which is returned from Windows Desktop
Search.
--> Currently, I use this value to ask Outlook to return the
EmailItem and
--> voilà the popup!
-->
-->
--> Michael


I guess the popup warning was occuring on the retrieval of the
MailItem.Body
action and not the
NameSpace.GetItemFromID(strEntryID, null)
call.

So, I just set the SafeMailItem.Item to equal the MailItem returned
from the GetItemFormID and then retrieve the Properties of the Mail
Object and no Outlook Security popups occur.


Thanks,

Michael
 
N

Neo

Is "Redemption" provided by Microsoft as part of VSTO?
or is it some 3rd party library? paid or free?

Regards
-Neo
 
K

Ken Slovak - [MVP - Outlook]

Redemption (www.dimastr.com/redemption) is not provided by MS. It is free
for personal use, if you want to redistribute code using Redemption you must
purchase the redistributable version and install it along with your code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top