Attachment not display in mail

Status
Not open for further replies.
A

Ashish

In outlook addin when i open a mail ActiveInspector_Activate event is

called. Here i add an attachment to this mail using MAPI. To add attachment

using MAPI

MapiSession->logon()

MapiMessage = MapiSession->GetMessage(entryid)

count = MapiMessage ->Attachment->Count

MapiMessage ->Attachment->Add(path)

MapiMessage ->Update();

count = MapiMessage ->Attachment->Count, new count returns one extra value.

it means attachment is added to mail but not display in mail. What should i

do to display attachment in open mail.
 
K

Ken Slovak - [MVP - Outlook]

Outlook has no idea that you added something using another API, CDO 1.21 in

this case. Just use the Outlook object model to add the attachment, Outlook

will show that automatically.

You're already using the object model to handle the Inspector.Activate()

event, why drop into CDO? Especially since CDO is security restricted and

may not even be installed.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:eNnMY0EOKHA.1796@TK2MSFTNGP02.phx.gbl...
> In outlook addin when i open a mail ActiveInspector_Activate event is
> called. Here i add an attachment to this mail using MAPI. To add
> attachment using MAPI
> MapiSession->logon()
> MapiMessage = MapiSession->GetMessage(entryid)
> count = MapiMessage ->Attachment->Count
> MapiMessage ->Attachment->Add(path)
> MapiMessage ->Update();

> count = MapiMessage ->Attachment->Count, new count returns one extra
> value. it means attachment is added to mail but not display in mail. What
> should i do to display attachment in open mail.
>
 
A

Ashish

Actually i was trying to use CDO functions in active inspector.

Is it possible to avoid active inspector and open mail using MAPI. I mean

when we open a mail NewInspector is call which open a mail. Can we avoid

this and use MAPI to open mail.
<kenslovak@mvps.org> wrote in message

news:ee4CIwGOKHA.1372@TK2MSFTNGP02.phx.gbl...
> Outlook has no idea that you added something using another API, CDO 1.21
> in this case. Just use the Outlook object model to add the attachment,
> Outlook will show that automatically.

> You're already using the object model to handle the Inspector.Activate()
> event, why drop into CDO? Especially since CDO is security restricted and
> may not even be installed.

> >

>

> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:eNnMY0EOKHA.1796@TK2MSFTNGP02.phx.gbl...
> > In outlook addin when i open a mail ActiveInspector_Activate event is
> > called. Here i add an attachment to this mail using MAPI. To add
> > attachment using MAPI
> > MapiSession->logon()
> > MapiMessage = MapiSession->GetMessage(entryid)
> > count = MapiMessage ->Attachment->Count
> > MapiMessage ->Attachment->Add(path)
> > MapiMessage ->Update();
>

>> count = MapiMessage ->Attachment->Count, new count returns one extra
> > value. it means attachment is added to mail but not display in mail. What
> > should i do to display attachment in open mail.
> >

>
 
K

Ken Slovak - [MVP - Outlook]

When you say MAPI do you mean CDO or Extended MAPI? Both Extended MAPI and

CDO aren't concerned with UI such as showing Inspectors.

I still have no idea why you are trying to complicate things that should be

very simple. Use the Outlook object model to add the attachment and Outlook

will immediately show it. No dropping into other API's required at all. Why

complicate things when they don't need to be? The KISS principle rules.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:umhTMQHOKHA.4580@TK2MSFTNGP06.phx.gbl...
> Actually i was trying to use CDO functions in active inspector.
> Is it possible to avoid active inspector and open mail using MAPI. I mean
> when we open a mail NewInspector is call which open a mail. Can we avoid
> this and use MAPI to open mail.
 
A

ashish

> When you say MAPI do you mean CDO or Extended MAPI? Both Extended MAPI and
> CDO aren't concerned with UI such as showing Inspectors.


As per my knowledge Exchange CDO is on top of MAPI. Please correct me if i

am wrong.


> I still have no idea why you are trying to complicate things that should
> be very simple. Use the Outlook object model to add the attachment and
> Outlook will immediately show it. No dropping into other API's required at
> all. Why complicate things when they don't need to be? The KISS principle
> rules.


CDO has Message interface which provides Update function. Update allows to

save data on exchange permanently or dont save permanently.It means we can

modify a mail but do not update on exchange. but using outlook programming

if we modify a mail then data will update permanently on exchange. thats why

i asked about this.

I want to modify mail when open it and should not update on exchange. I read

on net it's possible using MAPI. thats why i tried this.
>

>

> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:umhTMQHOKHA.4580@TK2MSFTNGP06.phx.gbl...
> > Actually i was trying to use CDO functions in active inspector.
> > Is it possible to avoid active inspector and open mail using MAPI. I mean
> > when we open a mail NewInspector is call which open a mail. Can we avoid
> > this and use MAPI to open mail.

>
 
K

Ken Slovak - [MVP - Outlook]

As I said before, neither CDO nor Extended MAPI deal with UI such as

displaying items. If you want the display updated then use the Outlook

object model. If you don't want the attachment to persist then delete it

when you are done with it.

"ashish" <akohli_2004@hotmail.com> wrote in message

news:%23i2ELmJOKHA.4816@TK2MSFTNGP04.phx.gbl...
> > When you say MAPI do you mean CDO or Extended MAPI? Both Extended MAPI
> > and CDO aren't concerned with UI such as showing Inspectors.


> As per my knowledge Exchange CDO is on top of MAPI. Please correct me if i
> am wrong.
>
> > I still have no idea why you are trying to complicate things that should
> > be very simple. Use the Outlook object model to add the attachment and
> > Outlook will immediately show it. No dropping into other API's required
> > at all. Why complicate things when they don't need to be? The KISS
> > principle rules.


> CDO has Message interface which provides Update function. Update allows to
> save data on exchange permanently or dont save permanently.It means we can
> modify a mail but do not update on exchange. but using outlook programming
> if we modify a mail then data will update permanently on exchange. thats
> why i asked about this.
> I want to modify mail when open it and should not update on exchange. I
> read on net it's possible using MAPI. thats why i tried this.
 
A

Ashish

Correct when i delete attachment i need to save mail also. otherwise

attachments will written on exchange. and saving mail will modify mail date

on exchange. I think you have already explained mail date will modify in

this case. I was just trying if MAPI helps in this or not.

Thnaks
<kenslovak@mvps.org> wrote in message

news:ue3POsJOKHA.4580@TK2MSFTNGP06.phx.gbl...
> As I said before, neither CDO nor Extended MAPI deal with UI such as
> displaying items. If you want the display updated then use the Outlook
> object model. If you don't want the attachment to persist then delete it
> when you are done with it.

> >

>

> "ashish" <akohli_2004@hotmail.com> wrote in message
> news:%23i2ELmJOKHA.4816@TK2MSFTNGP04.phx.gbl...
> >> When you say MAPI do you mean CDO or Extended MAPI? Both Extended MAPI
> >> and CDO aren't concerned with UI such as showing Inspectors.

>

>> As per my knowledge Exchange CDO is on top of MAPI. Please correct me if
> > i am wrong.
> >
> >> I still have no idea why you are trying to complicate things that should
> >> be very simple. Use the Outlook object model to add the attachment and
> >> Outlook will immediately show it. No dropping into other API's required
> >> at all. Why complicate things when they don't need to be? The KISS
> >> principle rules.

>

>> CDO has Message interface which provides Update function. Update allows
> > to save data on exchange permanently or dont save permanently.It means we
> > can modify a mail but do not update on exchange. but using outlook
> > programming if we modify a mail then data will update permanently on
> > exchange. thats why i asked about this.
> > I want to modify mail when open it and should not update on exchange. I
> > read on net it's possible using MAPI. thats why i tried this.

>
 
K

Ken Slovak - [MVP - Outlook]

Given the behavior of the various API's you have to decide if your spec can

live with those behaviors or if you have to re-think your specs.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:OILCtDSOKHA.3588@TK2MSFTNGP05.phx.gbl...
> Correct when i delete attachment i need to save mail also. otherwise
> attachments will written on exchange. and saving mail will modify mail
> date on exchange. I think you have already explained mail date will modify
> in this case. I was just trying if MAPI helps in this or not.
> Thnaks
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Attachment not display when add to mail Outlook VBA and Custom Forms 10
C Code to move mail with certain attachment name? Does Not work Outlook VBA and Custom Forms 3
kkqq1122 How would I add Search for attachment name Outlook VBA and Custom Forms 3
Owl Export Outlook PDF Attachment as JPG? Outlook VBA and Custom Forms 4
Timmon Remove just one attachment before AutoForward Outlook VBA and Custom Forms 0
P File Picker for attachment Outlook VBA and Custom Forms 0
D Forwarding email based on the attachment file type and specific text found on the attachment file name Outlook VBA and Custom Forms 1
N File Picker for attachment Outlook VBA and Custom Forms 2
G print attachment straight away; working script edit not working Outlook VBA and Custom Forms 0
G Save attachment run a script rule Outlook VBA and Custom Forms 0
M Autoforward just attachment OR just body. Outlook VBA and Custom Forms 0
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
T vba extract data from msg file as attachment file of mail message Outlook VBA and Custom Forms 1
K Outlook Office 365 VBA download attachment Outlook VBA and Custom Forms 2
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
S save attachment with date & time mentioned inside the file Outlook VBA and Custom Forms 0
O VBA Outlook Message Attachment - Array Index Out of Bounds Outlook VBA and Custom Forms 0
A Edit attachment Save and Reply Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
B Outlook 2010 Opening Mail Attachment Using Outlook 2
A Warning When Opening attachment Using Outlook 7
R Limiting length of saved attachment in VBA Outlook VBA and Custom Forms 2
F Script for zip file attachment Outlook VBA and Custom Forms 1
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1
L Attachment saving and tracking - PLEASE help! Outlook VBA and Custom Forms 5
H Outlook 2003 find by "has attachment" Using Outlook 1
9 Outlook 2016 How to save an Outlook attachment to a specific folder then delete the email it came from? Using Outlook 1
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
geofferyh Cannot get Macro to SAVE more than one message attachment??? Outlook VBA and Custom Forms 5
geofferyh How to change the Attachment File Name? Outlook VBA and Custom Forms 1
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
D Body text of email disappears when I scan an attachment from printer to email Using Outlook 1
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
W Save Outlook attachment in network folder and rename to current date and time Outlook VBA and Custom Forms 18
D Autosave Attachment and Rename Outlook VBA and Custom Forms 1
N Macro for attachment saved and combine Outlook VBA and Custom Forms 1
Andrew Quirl Open attachment, manipulate without add-on program? Outlook VBA and Custom Forms 5
V VB script code to save a specific email attachment from a given email Outlook VBA and Custom Forms 14
Commodore Attachment icon when there is no attachment Using Outlook 3
V Saving attachment from outlook in My Documents Outlook VBA and Custom Forms 14
N automatic response with an attachment based on the subject line Outlook VBA and Custom Forms 1
J Auto Forward - Include Attachment and change Subject depending on original sender Outlook VBA and Custom Forms 3
M Search for attachment filename Using Outlook 0
E Open olNoteItem Attachment Outlook VBA and Custom Forms 6
Vijay Reply all by attachment name Using Outlook 10
Michael R Belleville Making an Attachment Name the Message Subject Using Outlook 2
N Paste content to Excel when .txt file (attachment) is opened Outlook VBA and Custom Forms 1
P Outlook Randomly Not attaching (attachment file) Using Outlook 0
S VBA to search a keyword in attachment and move to a folder Outlook VBA and Custom Forms 0
Diane Poremsky The Attachment Size Exceeds the Allowable Limit Error Using Outlook 0

Similar threads

Top