Hi All Expecting yours reply for my question.
what i want to achieve is :-
I have few contacts in my application and i want to transfer them to outlook. And in outlook itself there are 3 to 5 user created contacts folder.
so first time i will ask user to pic the contact folder and once he chosen the contact folder, i will store the path of chosen contact folder in an .ini file
So next time when he transfers the contact I will not ask him to choose the folder again via the same code, instead i will transfer the contact to the same old contact folder, whose path i have saved in the .ini file.
so what i wanted to implement is to iterate all contact folders present in the outlook and get their path through pFolder->GetFullFolderPath(); function and compare it with saved path if found then i can use that folder object for moving my contact exactly there
something like this
pItem->Save();
pItem->Move(pFolder);
Partial Code snippet Below in VC++
_ApplicationPtr pApp;
_ItemsPtr pItems;
MAPIFolderPtr pFolder, pFolderChld;
_ContactItemPtr pContact;
HRESULT hr;
try
{
hr=pApp.CreateInstance(__uuidof(Application));
if (FAILED(hr))
{
MsageBox("Unable to instantiate Outlook.","Outlook Error",MB_OK);
return;
}
if(m_Option.GetCheck()) //default outlook contacts folder
{
pFolder=pApp->GetNamespace(_bstr_t("MAPI"))->GetDefaultFolder(olFolderContacts);
if (pFolder==NULL)
{
MessageBox("Could not find default contacts folder.","Outlook Error");
return;
}
}
else //display folder selection window
{
pFolder = pApp->GetNamespace(_bstr_t("MAPI"))->PickFolder();
if (pFolder==NULL)
return;
if (pFolder->GetDefaultItemType()!=olContactItem)
{
MessageBox("Select folder is not a Contact folder.","Outlook Contacts");
return;
}
else
{
BSTR bsPath = pFolder->GetFullFolderPath();
}