S
Semut
I have a COM add in. I try to call AddStore based on profile. Then, I use
Namespace.Logon("MyProfile", , true, true). Then, when I call the
AddStore(...). It appears that it did not addstore to the "MyProfile" that I
programmatically logon, instead, it will addstore to the default logon of
the Outlook. The Logon function does not seems to work on MAPI.. Any reason
why?
I am using the Application object where I obtain during OnConnection(..)
event handler. I have even try to create a new Application object but it
seems that the AddIn project does not allow it call the object could not be
created properly.
Anyone faced this problem before?
Below is my codes snippet
CComQIPtr<Outlook::_Application> spApp(g_AppDispatch);
CComBSTR nameSpaceType = T2W("MAPI");
CComPtr<Outlook::_NameSpace> spNameSpace;
spApp->GetNamespace(nameSpaceType,&spNameSpace);
CComVariant vEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComVariant vTrue(VARIANT_TRUE);
spNameSpace->Logon(vtProfileName, vEmpty, vTrue, vTrue);
CComPtr<Outlook::_Folders> spFolders;
spNameSpace->get_Folders(&spFolders);
long lNoOfFolders =0;
spFolders->get_Count(&lNoOfFolders); //failed to get the correct profile
number of folders
thanks
Namespace.Logon("MyProfile", , true, true). Then, when I call the
AddStore(...). It appears that it did not addstore to the "MyProfile" that I
programmatically logon, instead, it will addstore to the default logon of
the Outlook. The Logon function does not seems to work on MAPI.. Any reason
why?
I am using the Application object where I obtain during OnConnection(..)
event handler. I have even try to create a new Application object but it
seems that the AddIn project does not allow it call the object could not be
created properly.
Anyone faced this problem before?
Below is my codes snippet
CComQIPtr<Outlook::_Application> spApp(g_AppDispatch);
CComBSTR nameSpaceType = T2W("MAPI");
CComPtr<Outlook::_NameSpace> spNameSpace;
spApp->GetNamespace(nameSpaceType,&spNameSpace);
CComVariant vEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComVariant vTrue(VARIANT_TRUE);
spNameSpace->Logon(vtProfileName, vEmpty, vTrue, vTrue);
CComPtr<Outlook::_Folders> spFolders;
spNameSpace->get_Folders(&spFolders);
long lNoOfFolders =0;
spFolders->get_Count(&lNoOfFolders); //failed to get the correct profile
number of folders
thanks