Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Advanced
Jun 26, 2007

Save a URL as an MHT File

To save a URL as an MHT file (Microsoft "Multipurpose Internet Mail Extension HTML"—a Web Archive File), reference the Microsoft ActiveX Data Objects 2.7 and Microsoft CDO libraries and use the following code:

void SaveWebPageToMHTFile( string url, string filePath)
{
   CDO.Message msg = new CDO.MessageClass(); 
   ADODB.Stream stm = null ;
   msg.MimeFormatted =true;   
   msg.CreateMHTMLBody(url, 
      CDO.CdoMHTMLFlags.cdoSuppressNone, 
      "" ,"" );
   stm = msg.GetStream();
   stm.SaveToFile(filePath, 
      ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
   msg=null;
   stm.Close();
}
Srinath MS
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap