You are here: Office-Outlook.com  / Outlook Forum

attachment location

Home » Outlook addins and plugins development » Microsoft Office add-ins
attachment location [message #426383] Wed, 08 October 2008 02:19 Go to next message
sophie
Messages: 52
Registered: March 2007
Member
hi, all

I am working on attachment. I don't know how to get the location of a
sending email' attachment.

I want to do some operation before the email be sent.

is "Source Property" works? but when i use it like this
"objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
it seems wrong.

pathName property seem work, but when i check the mail attachment item,
pathName is null.

i need help.

thanks.
RE: attachment location [message #427253] Wed, 08 October 2008 05:38 Go to previous messageGo to next message
suemvp
Messages: 18932
Registered: May 2006
Senior Member
A file attached to a message is contained in that message, in the Attachments
collection. Outlook neither knows nor cares about the original location of
the file, which may no longer even exist.

If you want to do some work on that file, you need to save it to the local
drive using the Attachment.SaveAsFile method. You can then modify the file,
remove the original attachment, and add the new version.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54




"sophie" wrote:

> hi, all
>
> I am working on attachment. I don't know how to get the location of a
> sending email' attachment.
>
> I want to do some operation before the email be sent.
>
> is "Source Property" works? but when i use it like this
> "objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
> it seems wrong.
>
> pathName property seem work, but when i check the mail attachment item,
> pathName is null.
>
> i need help.
>
> thanks.
RE: attachment location [message #430145] Wed, 08 October 2008 05:38 Go to previous messageGo to next message
suemvp
Messages: 18932
Registered: May 2006
Senior Member
A file attached to a message is contained in that message, in the Attachments
collection. Outlook neither knows nor cares about the original location of
the file, which may no longer even exist.

If you want to do some work on that file, you need to save it to the local
drive using the Attachment.SaveAsFile method. You can then modify the file,
remove the original attachment, and add the new version.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54




"sophie" wrote:

> hi, all
>
> I am working on attachment. I don't know how to get the location of a
> sending email' attachment.
>
> I want to do some operation before the email be sent.
>
> is "Source Property" works? but when i use it like this
> "objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
> it seems wrong.
>
> pathName property seem work, but when i check the mail attachment item,
> pathName is null.
>
> i need help.
>
> thanks.
RE: attachment location [message #430148] Wed, 08 October 2008 19:20 Go to previous messageGo to next message
sophie
Messages: 52
Registered: March 2007
Member
Thanks sue.
I will try in this way.

"Sue Mosher [MVP-Outlook]" wrote:

> A file attached to a message is contained in that message, in the Attachments
> collection. Outlook neither knows nor cares about the original location of
> the file, which may no longer even exist.
>
> If you want to do some work on that file, you need to save it to the local
> drive using the Attachment.SaveAsFile method. You can then modify the file,
> remove the original attachment, and add the new version.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
>
>
> "sophie" wrote:
>
> > hi, all
> >
> > I am working on attachment. I don't know how to get the location of a
> > sending email' attachment.
> >
> > I want to do some operation before the email be sent.
> >
> > is "Source Property" works? but when i use it like this
> > "objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
> > it seems wrong.
> >
> > pathName property seem work, but when i check the mail attachment item,
> > pathName is null.
> >
> > i need help.
> >
> > thanks.
RE: attachment location [message #456626] Wed, 08 October 2008 05:38 Go to previous messageGo to next message
suemvp
Messages: 18932
Registered: May 2006
Senior Member
A file attached to a message is contained in that message, in the Attachments
collection. Outlook neither knows nor cares about the original location of
the file, which may no longer even exist.

If you want to do some work on that file, you need to save it to the local
drive using the Attachment.SaveAsFile method. You can then modify the file,
remove the original attachment, and add the new version.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54




"sophie" wrote:

> hi, all
>
> I am working on attachment. I don't know how to get the location of a
> sending email' attachment.
>
> I want to do some operation before the email be sent.
>
> is "Source Property" works? but when i use it like this
> "objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
> it seems wrong.
>
> pathName property seem work, but when i check the mail attachment item,
> pathName is null.
>
> i need help.
>
> thanks.
RE: attachment location [message #456632] Wed, 08 October 2008 19:20 Go to previous messageGo to next message
sophie
Messages: 52
Registered: March 2007
Member
Thanks sue.
I will try in this way.

"Sue Mosher [MVP-Outlook]" wrote:

> A file attached to a message is contained in that message, in the Attachments
> collection. Outlook neither knows nor cares about the original location of
> the file, which may no longer even exist.
>
> If you want to do some work on that file, you need to save it to the local
> drive using the Attachment.SaveAsFile method. You can then modify the file,
> remove the original attachment, and add the new version.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
>
>
> "sophie" wrote:
>
> > hi, all
> >
> > I am working on attachment. I don't know how to get the location of a
> > sending email' attachment.
> >
> > I want to do some operation before the email be sent.
> >
> > is "Source Property" works? but when i use it like this
> > "objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
> > it seems wrong.
> >
> > pathName property seem work, but when i check the mail attachment item,
> > pathName is null.
> >
> > i need help.
> >
> > thanks.
RE: attachment location [message #465763] Tue, 06 January 2009 19:23 Go to previous messageGo to next message
khai
Messages: 5
Registered: January 2009
Junior Member
Hi Sue,

The SaveAsFile method works for normail emails. However, when I try to
execute this method on inline attachments (namely, images), I get the
following error:

"Cannot save the attachment. Cannot add the attachment; no data source was
provided."

Could you shed some light on why this is so, and how can I overcome it? Many
thanks in advance.

"Sue Mosher [MVP-Outlook]" wrote:

> A file attached to a message is contained in that message, in the Attachments
> collection. Outlook neither knows nor cares about the original location of
> the file, which may no longer even exist.
>
> If you want to do some work on that file, you need to save it to the local
> drive using the Attachment.SaveAsFile method. You can then modify the file,
> remove the original attachment, and add the new version.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
>
>
> "sophie" wrote:
>
> > hi, all
> >
> > I am working on attachment. I don't know how to get the location of a
> > sending email' attachment.
> >
> > I want to do some operation before the email be sent.
> >
> > is "Source Property" works? but when i use it like this
> > "objMailItem.attachments.Source" or "objMailItem.attachments.item(1).source",
> > it seems wrong.
> >
> > pathName property seem work, but when i check the mail attachment item,
> > pathName is null.
> >
> > i need help.
> >
> > thanks.
Re: attachment location [message #465890] Wed, 07 January 2009 06:20 Go to previous messageGo to next message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
Sue's not available.

In that case there is nothing to go on for Outlook and most likely the
Attachment fields such as PR_ATTACH_FILENAME and such are blank. Are these
images or embedded Outlook objects? In any case about all you could do on a
low level would be to try to extract the attachment binary data and save
that out but you wouldn't know the file type or correct file format so that
wouldn't do much good at all.

--
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


"khai" <khai@discussions.microsoft.com> wrote in message
news:A01308F5-C069-4242-B7C2-D1A0EBA08B9A@microsoft.com...
> Hi Sue,
>
> The SaveAsFile method works for normail emails. However, when I try to
> execute this method on inline attachments (namely, images), I get the
> following error:
>
> "Cannot save the attachment. Cannot add the attachment; no data source was
> provided."
>
> Could you shed some light on why this is so, and how can I overcome it?
> Many
> thanks in advance.
Re: attachment location [message #467874] Fri, 09 January 2009 02:53 Go to previous messageGo to next message
khai
Messages: 5
Registered: January 2009
Junior Member
They are actually inline images. When I try to get the Type, it returns
olByValue.

I realise that I encounter this problem if I use Word 2003 to edit the email
messages (i.e. checkbox found under Tools -> Options -> Mail Format ->
Message Format).

Is there a work around, to ensure that inline images will be saved correctly
even if Word 2003 is chosen as the editor?

"Ken Slovak - [MVP - Outlook]" wrote:

> Sue's not available.
>
> In that case there is nothing to go on for Outlook and most likely the
> Attachment fields such as PR_ATTACH_FILENAME and such are blank. Are these
> images or embedded Outlook objects? In any case about all you could do on a
> low level would be to try to extract the attachment binary data and save
> that out but you wouldn't know the file type or correct file format so that
> wouldn't do much good at all.
>
> --
> 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
>
>
> "khai" <khai@discussions.microsoft.com> wrote in message
> news:A01308F5-C069-4242-B7C2-D1A0EBA08B9A@microsoft.com...
> > Hi Sue,
> >
> > The SaveAsFile method works for normail emails. However, when I try to
> > execute this method on inline attachments (namely, images), I get the
> > following error:
> >
> > "Cannot save the attachment. Cannot add the attachment; no data source was
> > provided."
> >
> > Could you shed some light on why this is so, and how can I overcome it?
> > Many
> > thanks in advance.
>
>
Re: attachment location [message #467935] Fri, 09 January 2009 06:36 Go to previous message
kenslovak
Messages: 13351
Registered: May 2006
Senior Member
Not really other than not using inline images.

--
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


"khai" <khai@discussions.microsoft.com> wrote in message
news:76D85CF6-06BB-4C71-8DA6-A8DEC7FBF70D@microsoft.com...
> They are actually inline images. When I try to get the Type, it returns
> olByValue.
>
> I realise that I encounter this problem if I use Word 2003 to edit the
> email
> messages (i.e. checkbox found under Tools -> Options -> Mail Format ->
> Message Format).
>
> Is there a work around, to ensure that inline images will be saved
> correctly
> even if Word 2003 is chosen as the editor?
Previous Topic:Sorting of plug-ins
Next Topic:Categories Quick Click
Goto Forum: