opening new custom contact form

A

Andrea Cacciarru

I have created my custom contact form and I have publicized it in Contact
folder itself. Now I would that when a default and already existent contact
item is opened, outlook displays my custom contact form.
I have created an OnNewInspector() method that catches the new inspector
event:

void __stdcall OutlookAddin::OnNewInspector(IDispatch* pdispInspector)
{
HRESULT hr;
CComQIPtr <Outlook::_Inspector> spInspector;
CComQIPtr <Outlook::_ContactItem> pContact;

IDispatch* pDispItem;
spInspector = pdispInspector; //get current
inspector
spInspector->get_CurrentItem(&pDispItem); //get current item
hr = pDispItem->QueryInterface(&pContact); //hr == S_OK only if the item
is a real ContactItem
if (FAILED(hr))
return;

_bstr_t messClass = "IPM.Contact.MyForm"; //new message class string
BSTR bstrMessClass = messClass.copy();
pContact->put_MessageClass(bstrMessClass); //modify current contact item
message class
pContact->Save(); //save
current item with new message class
pContact->Display(); //display
current item
}

the problem is that when pContact->Display(); displays the contact item, it
displays still old default contact form, although that MessageClass is
changed from "IPM.Contact" to "IPM.Contact.MyForm". This happens always,
until I restart my outlook 2003 application.
Because this fact can happens?

Thanks in advance
Andrea
 

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