473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to grab attachment from a list of given URL

Hi,
I try to design a window application to grab attachment from a list of given
URL and save them to a user difined folder on their local drive.

The list of URL for me to grab attachment will be saved in text file format.
The URL's might be ending with attachment file types: .jpg, .gif, pdf...also,
they might be just an ASP page.

I would like to have number of downloaded attachment displayed on the form
while the program is downloading, as well as a pictureBox displaying each
successfully downloaded picture (except .ptf).

Any good ideas for me to do so in C# in VS 2005? Is there any example code
that I could use?

Thanks,

Sophie
Dec 31 '06 #1
5 2875
Sophie,

This is thousand times done with the Webbrowswer, however I think that
everybody sees this as a kind of personal chalenge. If you search on
Internet you can find a lot of it. You need it in combination with MSHTML to
get the Anchor and Image tags and related information.

You cannot get an ASP page doing this, only the HTML results of that.
Getting ASP pages is hacking.

Cor

"Sophie" <So****@discussions.microsoft.comschreef in bericht
news:BD**********************************@microsof t.com...
Hi,
I try to design a window application to grab attachment from a list of
given
URL and save them to a user difined folder on their local drive.

The list of URL for me to grab attachment will be saved in text file
format.
The URL's might be ending with attachment file types: .jpg, .gif,
pdf...also,
they might be just an ASP page.

I would like to have number of downloaded attachment displayed on the form
while the program is downloading, as well as a pictureBox displaying each
successfully downloaded picture (except .ptf).

Any good ideas for me to do so in C# in VS 2005? Is there any example code
that I could use?

Thanks,

Sophie

Dec 31 '06 #2
Thank you. I will look for the infomation for "MSHTML to get the Anchor and
Image tags" on the web.

Sophie

"Cor Ligthert [MVP]" wrote:
Sophie,

This is thousand times done with the Webbrowswer, however I think that
everybody sees this as a kind of personal chalenge. If you search on
Internet you can find a lot of it. You need it in combination with MSHTML to
get the Anchor and Image tags and related information.

You cannot get an ASP page doing this, only the HTML results of that.
Getting ASP pages is hacking.

Cor

"Sophie" <So****@discussions.microsoft.comschreef in bericht
news:BD**********************************@microsof t.com...
Hi,
I try to design a window application to grab attachment from a list of
given
URL and save them to a user difined folder on their local drive.

The list of URL for me to grab attachment will be saved in text file
format.
The URL's might be ending with attachment file types: .jpg, .gif,
pdf...also,
they might be just an ASP page.

I would like to have number of downloaded attachment displayed on the form
while the program is downloading, as well as a pictureBox displaying each
successfully downloaded picture (except .ptf).

Any good ideas for me to do so in C# in VS 2005? Is there any example code
that I could use?

Thanks,

Sophie


Dec 31 '06 #3
Say, I have the following in text file:

http://cdx.xceligent.com/Attachments/034/826034.jpg
http://cdx.xceligent.com/Attachments/425/868425.pdf

What kind of method I should use to download the attachments to my local
machine by using C#?

Thanks,

Sophie

"Cor Ligthert [MVP]" wrote:
Sophie,

This is thousand times done with the Webbrowswer, however I think that
everybody sees this as a kind of personal chalenge. If you search on
Internet you can find a lot of it. You need it in combination with MSHTML to
get the Anchor and Image tags and related information.

You cannot get an ASP page doing this, only the HTML results of that.
Getting ASP pages is hacking.

Cor

"Sophie" <So****@discussions.microsoft.comschreef in bericht
news:BD**********************************@microsof t.com...
Hi,
I try to design a window application to grab attachment from a list of
given
URL and save them to a user difined folder on their local drive.

The list of URL for me to grab attachment will be saved in text file
format.
The URL's might be ending with attachment file types: .jpg, .gif,
pdf...also,
they might be just an ASP page.

I would like to have number of downloaded attachment displayed on the form
while the program is downloading, as well as a pictureBox displaying each
successfully downloaded picture (except .ptf).

Any good ideas for me to do so in C# in VS 2005? Is there any example code
that I could use?

Thanks,

Sophie


Dec 31 '06 #4
Uri uri = new Uri("http://cdx.xceligent.com/Attachments/034/826034.jpg");
System.Net.WebRequest request = System.Net.WebRequest.Create(uri);
using (System.Net.WebResponse response = request.GetResponse())
{
using (System.IO.Stream stream = response.GetResponseStream())
{
using (System.IO.Stream outputStream = new
System.IO.FileStream(@"c:\out.dat", System.IO.FileMode.Create))
{
byte[] inputBuffer = new byte[Math.Max(1024,
response.ContentLength)];
int bytesRead = 0;
do
{
bytesRead = stream.Read(inputBuffer, 0,
inputBuffer.Length);
if (bytesRead 0)
{
outputStream.Write(inputBuffer, 0, bytesRead);
}
}
while (bytesRead != 0);
}
}
}
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Sophie" wrote:
Say, I have the following in text file:

http://cdx.xceligent.com/Attachments/034/826034.jpg
http://cdx.xceligent.com/Attachments/425/868425.pdf

What kind of method I should use to download the attachments to my local
machine by using C#?

Thanks,

Sophie

"Cor Ligthert [MVP]" wrote:
Sophie,

This is thousand times done with the Webbrowswer, however I think that
everybody sees this as a kind of personal chalenge. If you search on
Internet you can find a lot of it. You need it in combination with MSHTML to
get the Anchor and Image tags and related information.

You cannot get an ASP page doing this, only the HTML results of that.
Getting ASP pages is hacking.

Cor

"Sophie" <So****@discussions.microsoft.comschreef in bericht
news:BD**********************************@microsof t.com...
Hi,
I try to design a window application to grab attachment from a list of
given
URL and save them to a user difined folder on their local drive.
>
The list of URL for me to grab attachment will be saved in text file
format.
The URL's might be ending with attachment file types: .jpg, .gif,
pdf...also,
they might be just an ASP page.
>
I would like to have number of downloaded attachment displayed on the form
while the program is downloading, as well as a pictureBox displaying each
successfully downloaded picture (except .ptf).
>
Any good ideas for me to do so in C# in VS 2005? Is there any example code
that I could use?
>
Thanks,
>
Sophie
Dec 31 '06 #5
If you need to parse through the HTML of a rendered web page to extract
links to images, PDF etc. suggest you take a look at Simon Mourier's
HtmlAgilityPack.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sophie" wrote:
Hi,
I try to design a window application to grab attachment from a list of given
URL and save them to a user difined folder on their local drive.

The list of URL for me to grab attachment will be saved in text file format.
The URL's might be ending with attachment file types: .jpg, .gif, pdf...also,
they might be just an ASP page.

I would like to have number of downloaded attachment displayed on the form
while the program is downloading, as well as a pictureBox displaying each
successfully downloaded picture (except .ptf).

Any good ideas for me to do so in C# in VS 2005? Is there any example code
that I could use?

Thanks,

Sophie
Jan 1 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: werdna.sivad | last post by:
In PHP is there a way to grab the HTTP Pipeline? I want to be able to grab all the HTML code that gets streamed to the user. I want to add the ability to send copies of a page as an email...
2
by: Chris Kane | last post by:
We have written a class that enumerates the items in a WSS list and then attemptes to open the attachment for each item. We have written two classes, one to impersonate a user and read in the list...
1
by: bhavik | last post by:
hi I have problem with attachment showing form server side. when our application run on localhost we add any attachment to mail server. if suppose we want to show that attachment we can see...
2
by: Robbie De Sutter | last post by:
Hello, How do I open a new, empty e-mail message from the default e-mail client whereby the sender is given and a file is attached? Currently I use the command (vb.net): ---...
1
by: Filipe Marcelino | last post by:
hi, i'm developing an application that will be capable of retrive an email from a pop server and retrieve the attachments of each mail message. I can so this of any type of file except text...
7
by: erikcw | last post by:
Hi all, I'm trying to extract zip file (containing an xml file) from an email so I can process it. But I'm running up against some brick walls. I've been googling and reading all afternoon, and...
1
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the...
5
by: goldenteeplanet | last post by:
void reverse( node * & s) { // NOTE: YOU CAN NOT MOVE DATA FROM ONE NODE TO ANOTHER // YOU CAN ONLY MOVE POINTERS FROM ONE NODE TO ANOTHER //...
0
by: sandeep98811 | last post by:
I am getting following weird issue, "When forwarding an email with an open attachment the user warned twice that an attachment is open". I am catching Forward event of mail item in function...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.