Disable Send button in ".msg" file...

  • Thread starter Thread starter vinkal.chudgar
  • Start date Start date
V

vinkal.chudgar

Hi,

I have developed outlook addin in ATL.

I am using MS Outlook 2003.

when user compose a new mail and press a send button,Send event is
captured which is associated with OnSendMail()and hence OnSendMail()
function gets called.

In OnSendMail(), i am saving mail as ".msg" (say 1.msg) file on Disk.

Now i want to disable send button in such manner that

when someone double click ".msg" file (say 1.msg) stored on disk the
send button should seem to be disabled

OnSendFunction look likes as follows:

void __stdcall OnSendMail(IDispatch* /*Office::_CommandBarButton*/
Ctrl,VARIANT_BOOL * CancelDefault)
{

CComQIPtr < Outlook::_MailItem > spMail(Ctrl);

spMail->SaveAs("c:\\1.msg");

}

I would be grateful to me , if someone could give me code example or
some direction.

Regards,

Vinkal
 
Normally, you could trap the Inspectors.NewInspector event and hide the Send
button for the Inspector object passed in as an argument.
The problem is there is no way to find out whether Outlook is displaying an
MSG file or a regular message.
If you control saving the MSG file, you can add a special property (using
MailItem.UserProperties) and check it later in the NewInspector event to
figure out if the prop is present and you need to hide the Send button.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dear Dmitry,

Thanks for your reply.

My requirement is as follows.

For example i have save msg on disk (c:\1.msg) using outlook addin and
now i give you ".msg" file (1.msg) to you and you store "1.msg" file on
disk (for example c:\1.msg) and no addin is loaded on your machine.

When you open the "1.msg" file by double cliking it,the "1.msg" should
be opened with "SEND" button disabled.

So is there any property or method of IMailItem or other object so that
i can disble send button and this feature is embeded when save as
".msg" ?

Regards,

Vinkal
 
Back
Top