Refresh Calendar Folder List After Create New Folder

T

TerryAtGmail

I'm using Outlook 2003 and I have a background process that adds new
subfolders to the root calendar folder (GetDefaultFolder(olFolderCalendar))
using the Outlook C++ COM interface.

When I start Outlook and am sitting in the mail view, the background process
adds 1 or more subfolders to the root calendar folder. When I switch to the
calendar view the new folders aren't displayed. If I restart Outlook or do
something to display the list of all folders the list refreshes and the
folders I added are displayed.

When I start Outlook and have the calendar view selected when the background
process adds 1 or more subfolders to the root calendar folder, the folders
show up as they are added.

Is there a way to invalidate the list of folders or refresh the list of
folders so that my new folders will be display in the first case?

The background process gets an Outlook instance like this:

CLSID clsidOutlook;CLSIDFromProgID(L"Outlook.Application", &clsidOutlook);

HRESULT hr = CoCreateInstance(clsidOutlook, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch,(void **)&pOutlookPtr);

Gets the MAPI namespace like this:

CComQIPtr <Outlook::_Application> pApplication(pOutlookPtr);
CComQIPtr <Outlook::_NameSpace>
pNamespace(pApplication->GetNamespace(L"MAPI"));

And gets the rool calendar folder like this:

CComQIPtr <Outlook::MAPIFolder>
pRootCal(pNamespace->GetDefaultFolder(olFolderCalendar));

I do not log into Outlook:
// hr = pNamespace->Logon(vEmpty, vEmpty, vEmpty, vEmpty);

But this doesn't make a difference if I do.
 

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