Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to save outlook attachments files in particular location using c# windows application. That location(path)get from csv file. I used this coding

C#
TargetFolder.Items[i].Attachments[1].SaveAsFile(@SaveLocation + i + " " + TargetFolder.Items[i].Attachments[1].FileName);


here SaveLocation - i got this from csv file, but it shows an error, file location not found.
Posted

1 solution

What is the value of @SaveLocation? You'll want to make sure the directory (if it is a directory) exists. You could use the System.IO.Directory.CreateDirectory() method to create it. Then you may want to use System.IO.Path.Combine() to essentially append @"\" and the file name before saving it.
 
Share this answer
 
Comments
DANIAL RAVI 4-Dec-13 0:08am    
Sir,
Here SaveLocation is the path to save attachments file, this one i got from CSV file

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900