Thanks Dmitry!
Nice to see I was making it more complicated than it needed to be (as
usual). That sorted me right out!
-Gabriel
"Dmitry Streblechenko" wrote:
Pass "MAPI" as the parameter when calling Application.getNamspace. Yopu can
also use Application.Session.
Calling MailItem.Delete will move it to theDeleted Items folder.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Gabriel" wrote in message
...
Hi, back with another newbie question. I'm writing an add-in for Outlook
2003
in VC++. I'm trying to move a message I've accessed by using the
Explorer-get_Selection method to the "Deleted Items" folder, but I'm
running
into trouble. *Part* (hopefully all?) of the problem is I don't know what
the
first parameter for GetNamespace is supposed to be (I just have a
placeholder
there. Here's what I tried:
CComPtr Outlook::_NameSpace spNamespace;
CComPtr Outlook::MAPIFolder spFolder;
// Need to know what to pass for first parameter:
m_spApp-GetNamespace((unsigned short*)1, &spNamespace);
if (spNamespace == NULL)
MessageBox(NULL,"No Namespace","Namespace",MB_OK);
spNamespace-GetDefaultFolder(olFolderDeletedItems, &spFolder);
dispItem = NULL;
mailPtr2-Move(spFolder,&dispItem);
(mailPtr2 is a mail item pointer and is getting set correctly.) Outlook
crashes at the GetNamespace call. Other than that, does my reasoning look
sound? Let me know if I can provide more info.
Thanks in advance!
-Gabriel