Outlook - Attachment not display when add to mail
Asked By Ashish
16-Mar-09 07:13 AM
I add an attachment to mail when open the mail in outlook. When i double
click on a mail then attachment display in mail.But when i right click on
mail select Open then i cant see the attachment while if i click on
File->Save Attachments then it shows me the attachment name. Which property
need to set to display the attachment
Outlook.OlAttachmentType.olByValue
(1)
Outlook 2007
(1)
Outlook
(1)
Outlook.MailItem
(1)
Outlook.Attachments
(1)
Inspector.Activate
(1)
Ken Slovak - [MVP - Outlook] replied...
Show the code you use. Are you saving the item after you add the attachment?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Ashish replied...
No. I dont save the the item after adding attachment.
I add the attachment in Item_Open() eveny
item->Attachments->Add(filaname);
When i double click a mail attachment display in mail. WHen i right click
and select open then it's not display.
Ashish replied...
I dont save item when i open it. But in my outlook addin when i open a item
and add an attachment in item_open many item events called like item_open,
item_write, item_read, item_attachmentadd,item_beforeattachmentsave etc
If i disable item_write( avoid writing) then it other events for this item
are stop. Should i disable item_write. But if i disable it then how to
enable other events.
Ken Slovak - [MVP - Outlook] replied...
Don't disable the other events and try saving the item after you add the
attachment.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Ashish replied...
I have tried to save item after adding attachment but it still dont display
attachment. I'm not saving item before adding attachment. I dont have much
knowledge for outlook addin. I think it is happening due to following
reason.
In my addin Open a mail from inbox folder(subject-> test1) add an attachment
in item_open event and save this mail(test1.msg type) on hard
disk(File->SaveAs) and close. Now Open test1.msg from hard disk(since
test1.msg is also in Inbox folder, item_open event call 2 times). After
closing this mail i found 2 mails of subject test1.msg in inbox folder. I am
handling all mail events throgh Inspector.
When i open a mail
register inspector event in a inspector class and pass
Application->CurrentInspector
In Notify of inspector class register mail event(outlook::Items)
Please suggest where i'm wrong
Ken Slovak - [MVP - Outlook] replied...
Why are you saving the item as a MSG file and then re-opening it when you
already have that item saved in Outlook? What you are doing makes no sense
to me.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Ashish replied...
I just tell this only for knowing the reason why attachment not display.
Ok If i dont save item as msg and reopen it then i still have the save
problem for attachment(right click on a item and select open).
Ken Slovak - [MVP - Outlook] replied...
There should be no difference in how an item displays no matter how it's
opened.
You never did show any of your code, so no one knows what you are doing or
how.
Assuming you want to add an attachment when an item is opened then the way
I'd do it would be something like this, in the first Inspector.Activate()
event, assuming that _inspector is your Inspector object:
Outlook.MailItem mail = _inspector.CurrentItem;
Outlook.Attachments attachs = mail.Attachments;
Outlook.Attachment attach = attachs.Add(
Attachment Picture");
mail.Save();
// now release all those objects
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Ashish replied...
Thanks it's solved now. The problem was adding attachment in Item_Open
event. When i add attachment in Inspector.Activate() then it display.
I know how to use mail item event like item_open, item_close,item_fwd etc.
But i dont have idea how to implement context menu operations like when i
right click on any mail select any opertion like reply,forward etc. Are they
handled seperately
Ken Slovak - [MVP - Outlook] replied...
What version of Outlook? For Outlook 2007 you have various new context menu
events on the Application object that you can handle and a shared event for
when a context menu closes. There are separate events for folder, item,
attachment, shortcuts, etc.
For earlier versions of Outlook there is nothing like that and you have to
use hacks that mostly work but don't tell you what was right-clicked or
where in the Outlook design surface. Examples of the hacks and various
problems that can arise are at http://www.outlookcode.com. Search there on
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Bulletproof Exiting Outlook (and not crashing) Outlook In building an Outlook integration, I try to exit Outlook this way: Marshal.ReleaseComObject(objOutlook) objOutlook = Nothing Before I did this, sometimes this code would not execute, and Outlook would then get a bit messed up. I would have to load Outlook and wait for it to repair and / or shut down Outlook in the Task Manager. I do not want this ever to happen to a user code the best way to handle this scenario. I want to bulletproof an application with Outlook, and I do not want to corrupt a user's Outlook file. I am just
Default account Outlook I have 3 POP accounts and 1 IMAP account. One of my POP accounts is set to be the default. However no matter what I do Outlook uses the IMAP account as the default. How do I correct this? Outlook Discussions Outlook 2010 (1 Outlook 2007 (1) Outlook (1) Newsletter (1) Dailytips (1) Mailto (1) Outlook version? - - Brian Tillman [MVP-Outlook] So all new mail gets sent on the imap account
Saving attachments to folder from public folder Outlook Hey there! I am currently working on a project that involves merging data from many into one Excel workbook for analysis. The csv files are sent to a public folder (outlook: \ Public Folders \ All Public Folders \ etc. . .) I thought the easiest way to do this would be to import the data straight from Outlook to the Excel file but after much painful testing I could not get it to main mailbox folders, not public and am unsure why. . . I have almost no experience with Outlook coding so any help is appreciated! This is the current code: If there is a instead of using a selection, that is fine too! Public Sub SaveAttachments() Dim objOL As Outlook.Application Dim objMsg As Outlook.MailItem 'Object Dim objAttachments As Outlook.Attachments Dim objSelection As Outlook.Selection Dim i As Long Dim lngCount As Long Dim
Template or Form? Outlook I need to generate HTML email using Access 2007 / Outlook 2007. I have enough experience with VBA to gin up the code, but Outlook 2007 is something of a mystery to me. Here is what I have tried: 1. created template 2. attempted to insert text into the template like this Code: - -- -- -- -- -- -- -- -- -- - Set olApp = GetObject(, "Outlook.Application") Set olmi = olApp.CreateItemFromTemplate(strOftPath) olmi.HTMLBody = "text here" - -- -- -- -- -- -- -- -- -- - Unfortunately, this overwrites all the nice logos and such I had put in the template. Should I be using a Outlook Template or Form? I like the idea of using templates because they are discrete files
Outlook: Get Image Content ID from existing email Outlook Hi all, I have a little big problem. I must clone some email to a read at this time all properties (from, to, subject, etc) from the existing email in Outlook 2002 / 2007 via VBA. We have some emails with embedded images in the email body. When I a new mail with a embedded image. Thanks a lot for help. Best regards, Tora Outlook Program VBA Discussions EmbeddedHTMLGraphicDemo (1) MAPI.Message (1) Outlook 2007 (1) Outlook 2003 (1) Outlook (1) Office (1) If you have looked at those examples of creating