More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

forum 09-Sep-2010 06:03

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

    Page [ 1 ]  
 Basic Outlook Printer Friendly Version
Working with Outlook items, folders, recipients; dealing with security; writing event handlers
Topic
Change in forward mail also change selected mail
Hi Sue, In my previous post i already discussed that outlook change the body of selected mail if we change forward mail.
I have a sample application which i got from following site. And i am not using my addin code in this application.
http://www.codeproject.com/KB/COM/outlookaddin.aspx

In this application i register inspector event. When select a mail in outlook click on forward button it calls onnewinspector
here i change mailbody and return. After that i found mail body is also change in selected mail.
So i think it's serious issue in Outlook.
I attach the project on rapidshare, please get it from
http://rapidshare.com/files/302193923/sample1.rar.html

In Onnewinspector below code change body

HRESULT CAddin::Invoke(DISPID dispidMember,REFIID riid,LCID lcid, WORD wFlags,
                        DISPPARAMS* pDispParams, VARIANT* pvarResult,
                        EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
 
    if(dispidMember = 0xf001)
    {
        if (!pDispParams)
            return E_INVALIDARG;
    
        if (pDispParams->cArgs > 0)
        {
           IDispatchPtr pDisp(pDispParams->rgvarg[0].pdispVal);
           CComQIPtr<_Inspector> spInspector(pDisp);
            IDispatchPtr dsptr = NULL;
            spInspector->get_CurrentItem(&dsptr);
            _MailItemPtr mptr = NULL;
            mptr = dsptr;
            _bstr_t bd = "this is new body";
            if(mptr)
            {
                RecipientsPtr rptr = NULL;
                mptr->get_Recipients(&rptr);
                if(rptr)
                {
                    long count = 0;
                    rptr->get_Count(&count);
                    if(count == 0)
                        mptr->put_Body(bd);
                    mptr = NULL;
                }
            }
        }
    }
    return S_OK;
}

  04-Nov-2009  02:40
    Page [ 1 ]  
Post a new message to this topic.



name        email