oh. It means i need to change my design again. To complete my task there is
one more way. I am adding an empty attachment to a mail on exchange server
using CDO. But when i see this mail in outlook/owa, i found attachment size
is change. it's 4 bytes or 64 bytes or 128 bytes. Dont know why but outlook
shows its size. I think if attachment size is 0 bytes then outlook will not
display it in right pane. When i open this attachment in outlook it has no
data. Can i hide this attachment? Means it should not display in right pane
when i select this mail in active explorer. Using CDO when i add this
attachment on exchange server i did not find any way to hide it. So i try in
outlook. I'm using following code to hide it in outlook. Code execute when
click on a mail(which has empty attachment) in active explorer.
Suppose mail item has one empty attachment
LPMESSAGE lpMessage = (IMessage*)(IUnknown*)
mailitem->Attachments->Item(1)->MAPIOBJECT;
SPropValue pProp;
pProp.ulPropTag = PR_ATTACHMENT_HIDDEN;
pProp.Value.b = true;
HRESULT hr = HrSetOneProp(lpMessage, &pProp);
if(hr == S_OK)
lpMessage->SaveChanges(FORCE_SAVE);
Also i have tried to change other properties like PR_ATTACH_METHOD,
PR_ATTACH_FILE_NAME etc. but nothing happed. I have tried not to use
SaveChanges method but no result.
<kenslovak@mvps.org> wrote in message
news:O%233u6bxKKHA.3708@TK2MSFTNGP02.phx.gbl...
> I don't think what you want is possible, no. Not using the Outlook object
> model anyway.
> >
>
> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:eK8qe8wKKHA.3424@TK2MSFTNGP02.phx.gbl...
> > To modify item i'm only adding attachment for a selected item in outlook
> > explorer. And when select another item i delete attachment from previous
> > item where i add. All this i'm doing without saving item. But this action
> > save item on exchange server. But we can avoid this saving as below link
> > says that
> > http://codeidol.com/csharp/c-sharp-in-office/Working-with-Outlook-Events/Outlook-Item-Events/
>
>> My motive is to display attachments when select a item and delete them
> > when select another item. And this all should not modify on exchange
> > server.
> > It it not possible?
>