473,805 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2895
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****@discuss ions.microsoft. comschreef in bericht
news:BD******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comschreef in bericht
news:BD******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comschreef in bericht
news:BD******** *************** ***********@mic rosoft.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.c om/Attachments/034/826034.jpg");
System.Net.WebR equest request = System.Net.WebR equest.Create(u ri);
using (System.Net.Web Response response = request.GetResp onse())
{
using (System.IO.Stre am stream = response.GetRes ponseStream())
{
using (System.IO.Stre am outputStream = new
System.IO.FileS tream(@"c:\out. dat", System.IO.FileM ode.Create))
{
byte[] inputBuffer = new byte[Math.Max(1024,
response.Conten tLength)];
int bytesRead = 0;
do
{
bytesRead = stream.Read(inp utBuffer, 0,
inputBuffer.Len gth);
if (bytesRead 0)
{
outputStream.Wr ite(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****@discuss ions.microsoft. comschreef in bericht
news:BD******** *************** ***********@mic rosoft.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
1376
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 attachment. The pages are already built and working, so it would be nice to not have to duplicate code that already exists. Can I just have it grab what it sends to the user and then save that into a file? Do you understand what I'm asking for?
2
3827
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 information and the other to be called by the first which actually opens the attachment. Our code fails when it tries to open the attachment in the second class with a 401 - Unauthorized error from IIS on http://localhost/_vti_bin/owssrv.dll. ...
1
1350
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 that attachment with View button. so in view button I me giving path of local machine and attachment will be showing. but..... when I upload that application on server machine and when I click
2
12190
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): --- System.Diagnostics.Process.Start("mailto:someone@somewhere&subject=the% 20subject") ---
1
1629
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 files an xml files. This kind of files doesn't appear in the attachment list. Why? If they don't appear how can I retrieve a xml or text file attachment? This is really important for the future of this application. I don't whant to force my users...
7
7650
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 can't seem to figure it out. Here is what I have so far. p = POP3("mail.server.com")
1
3210
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 code for attachment, I am not able to send anything. I get blank email. Can you please help me on this? Here is the html form:
5
2491
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 // Grab the first node` // Create startNode = s; node *guest,*secondToLast,*secondElem;
0
1748
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 _mail_Forward(). Steps to reproduce issue: 1. Open email , open attachment 2. Click on Forward Button, 3. Outlook displays message "The attachment "test" is open or in use by another application. If you continue, you will lose any changes you...
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.