Suppose mail has one 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.
> In my outlook addin i'm trying to hide attachment for a mail in active
> explorer when this mail is select using following code
>
> Suppose mail has one attachment
>
> LPMESSAGE lpMessage = (IMessage*)(IUnknown*)
> mailitem->Attachments->Item(1)->MAPIOBJECT;
IIRC you cannot hide a single attachment in a mail but only
tell a mail to hide all its attachments.
So try to use:
LPMESSAGE lpMessage = (IMessage*)(IUnknown*)
mailitem->MAPIOBJECT;
(btw: your code looks like you are leaking MAPIOBJECT)
followed by your code.
--
SvenC
> Thanks for your response.
> If i use MAPIOBJECT of mail item then which property i need to reset. I
> think i cant not access PR_ATTACHMENT_HIDDEN through mail item mapi object.
> I have tried to use PR_ATTR_HIDDEN through redemption outspy but attachment
> still display in right pane.
Sorry, i remembered incorrectly. PR_ATTACHMENT_HIDDEN on the attachment
is the correct way to go. But you will need to get an IMAPIProp (or IAttach) of
the attachment and an IMAPIProp (or IMessage) of the mail and after setting the
property on the attachment you need to call SaveChanges on the attachment
and on the mail interface.
To make the attachment icon on the mail disappear you need to set
PR_HIDE_ATTACH to true which is a named property with this DASL
http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B
So it is a boolean with the MAPINAMEID id 0x8514
--
SvenC
Can we hide attachment on exchange server using CDO also?
I tried to do it like
Suppose a mail has one attachment, i open this mail using IDataSource->Open
and access this using CDO::IMessage. When i check that mail in outlook it
still has attachment.
CDO::IMessage Msg;
FieldsPtr Flds;
IBodyPartPtr bodypart = Msg->Attachments->Item[i];
Flds = bodypart->Fields;
try
{
Fldsat->Item[
"http://schemas.microsoft.com/mapi/proptag/0x7FFE000B" ]->Value
= _variant_t( "1" );
Fldsat->Update();
Fldsat = NULL;
}
catch(...)
{
}
"SvenC" <Sv...@nospam.nospam> wrote in message
news:uNWxVJJL...@TK2MSFTNGP04.phx.gbl...
> If i call SaveChanges(FORCE_SAVE) then it updates mail last modified date.
> Can we hide icon without changing mail last modified date.
I doubt it.
> Using CDO::IMessage, CDO::IBodyPart i am not able to hide icon. Is it
> possible? Is there any example
Never used that version of CDO except for very basic mailing tasks.
So, I don't know.
--
SvenC
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Ashish" <akohl...@hotmail.com> wrote in message
news:u8eTTBWL...@TK2MSFTNGP05.phx.gbl...
>>> If i call SaveChanges(FORCE_SAVE) then it updates mail last modified
>>> date. Can we hide icon without changing mail last modified date.
>>
>> I doubt it.
>
> Do you mean SaveChanges(FORCE_SAVE) should not update any date of the mail
No. I was answering your last sentence "Can we hide icon without changing mail
last modified date." And my answer to that question was "I doubt it".
Otherwise, Dmitry has brought it to the point in his answer.
--
SvenC
When we hide attachments in active explorer when select a mail, it's not
reflected immediately in right pane. we need to select another item then go
back to original item to see attachments are hide. Can we reflect right pane
immediately when select a mail. Is there any refresh method or something
else?
"Ashish" <akohl...@hotmail.com> wrote in message
news:u8eTTBWL...@TK2MSFTNGP05.phx.gbl...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"varun" <varun....@yahoo.co.in> wrote in message
news:OuhYvlZL...@TK2MSFTNGP03.phx.gbl...