A
Anthony Yio
Hello,
I am trying to add folder to the Personal Folders but it failed. It
could only add folder under my Default Mail , Task sub folder but not
directly under my root folder 'Personal Folder'
Below are my codes
BSTR senderName=NULL;
long lUnreadItemCount=0;
CComPtr<Outlook::MAPIFolder> spMAPIFolder;
CComPtr<Outlook::_Folders> spFolder;
CComPtr<Outlook::_Folders> spSubFolder;
CComPtr<Outlook::_Items> spItems;
CComPtr<Outlook::_NameSpace> spNameSpace;
CComPtr<Outlook::_DRecipientControl> spRecipientCtrl;
BSTR nameSpaceType = T2W("MAPI");
m_spApp->GetNamespace(nameSpaceType,&spNameSpace);
spNameSpace->GetDefaultFolder(olFolderInbox,&spMAPIFolder);
CComPtr<Outlook::_Folders> spTestFolder;
CComPtr<Outlook::MAPIFolder> spAddedMAPIFolder;
spMAPIFolder->get_Folders(&spTestFolder);
spTestFolder->Add(_bstr_t("TEST"), _variant_t((long)olFolderInbox),
&spAddedMAPIFolder); //this will work on add to folder under default mail
folder.
CComPtr<Outlook::MAPIFolder> spAddedSubFolder;
spFolder->Add(_bstr_t("TEST AGAIN"), _variant_t((long)olFolderJournal),
&spAddedSubFolder); //this will NOT work. Any pointers?
thanks in advance.
I am trying to add folder to the Personal Folders but it failed. It
could only add folder under my Default Mail , Task sub folder but not
directly under my root folder 'Personal Folder'
Below are my codes
BSTR senderName=NULL;
long lUnreadItemCount=0;
CComPtr<Outlook::MAPIFolder> spMAPIFolder;
CComPtr<Outlook::_Folders> spFolder;
CComPtr<Outlook::_Folders> spSubFolder;
CComPtr<Outlook::_Items> spItems;
CComPtr<Outlook::_NameSpace> spNameSpace;
CComPtr<Outlook::_DRecipientControl> spRecipientCtrl;
BSTR nameSpaceType = T2W("MAPI");
m_spApp->GetNamespace(nameSpaceType,&spNameSpace);
spNameSpace->GetDefaultFolder(olFolderInbox,&spMAPIFolder);
CComPtr<Outlook::_Folders> spTestFolder;
CComPtr<Outlook::MAPIFolder> spAddedMAPIFolder;
spMAPIFolder->get_Folders(&spTestFolder);
spTestFolder->Add(_bstr_t("TEST"), _variant_t((long)olFolderInbox),
&spAddedMAPIFolder); //this will work on add to folder under default mail
folder.
CComPtr<Outlook::MAPIFolder> spAddedSubFolder;
spFolder->Add(_bstr_t("TEST AGAIN"), _variant_t((long)olFolderJournal),
&spAddedSubFolder); //this will NOT work. Any pointers?
thanks in advance.