Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / August 2003

Tip: Looking for answers? Try searching our database.

error - cannot save the attachment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Venkat - 21 Aug 2003 13:58 GMT
Hi,

When I tried to save the attachments of a mail item, using
the following code snippet,

strTempFolderPath = "C:\temp\"
For intLoop = 1 To objAttachments.Count
objAttachments.Item(intLoop).SaveAsFile strTempFolderPath
& objAttachments.Item(intLoop).FileName
Next

I got an error message "Cannot save the attachment. The
file name is in use by Outlook for a temporary file.
Rename the item, and then try again."

What does the error message mean? What is the cause and
resolution for this error? Please clarify as soon as
possible.

Venkat.
James Winton - 21 Aug 2003 22:47 GMT
You might try outputing to a different directory.
Version of OL, Dev Environment and windows platform would help.

I put your code into a vb.net, OL2002 and windows 2k,

I was able to reproduce your error "Additional information: Cannot save the
attachment. This file name is in use by Outlook for a temporary file. Rename
the item, and then try again."

when you open an e-mail with an attachement, the attachement is stored in a
temp folder on the local hard drive.  My attachments are tucked way under my
doc and settings folder.  Yours appear to be going to the C:\temp\ folder.
so, when you try to save it there, you are blocked by outlook, since outlook
has already placed a copy of it there.  If you output to a different
directory, you will probably be ok.

What OS are you on?  I'm going to guess NOT XP or 2000 or NT. Just seeing if
I have a clue.

> Hi,
>
[quoted text clipped - 16 lines]
>
> Venkat.
Venkat - 22 Aug 2003 05:35 GMT
Outlook Version : 2000
Dev Environment : Visual Basic 6.0, MS Office 9.0 Object
Library, MS Outlook 9.0 Object Library
Windows Platform : Windows NT Workstation

But I run the application in Windows 2000 Professional
machine having outlook 2000.

In my application, I have used Environ$("Temp") for saving
the attachments of a mail item. Not hardcoded "C:\Temp\".
Expecting a reply.

Thanks,
Venkat.

>-----Original Message-----
>You might try outputing to a different directory.
[quoted text clipped - 38 lines]
>
>.
James Winton - 22 Aug 2003 17:56 GMT
The issue is still the same then, and it makes more sense.

Check the value of Environ$("Temp") before you do save as on an attachement.
Go to that path and you will see the File is already there, placed there by
outlook when you opened the message.

You will need to save the file somewhere other than the Temp var path.

> Outlook Version : 2000
> Dev Environment : Visual Basic 6.0, MS Office 9.0 Object
[quoted text clipped - 64 lines]
> >
> >.
James Winton - 21 Aug 2003 22:50 GMT
You may also want to loop through the attachments collection, rather than
using a for loop counter.

dim objAttchments as attachments
dim objAttchment as attachment

for each objAttchments in objAttchments
'executing code
next

> Hi,
>
[quoted text clipped - 16 lines]
>
> Venkat.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.