Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

.NET

It will help to solve your project problems in .net

Send mail through WebDav using Exchange Server

using System;

System;

using System.Collections.Generic;

System.Collections.Generic;

using System.Net;

System.Net;

using System.IO;

System.IO;

using System.Text;

System.Text;

using System.Collections;

System.Collections;

namespace SendingMessageWebDAV

{

class Program

SendingMessageWebDAV

{

class Program

class Program

{

[STAThread]

static void Main(string[] args)

{

Program obj = new Program();

obj.SendmailAttachment();

Console.ReadLine();

}

System.Net.HttpWebRequest PUTRequest;

System.Net.HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

STAThread]

static void Main(string[] args)

{

Program obj = new Program();

obj.SendmailAttachment();

Console.ReadLine();

}

System.Net.HttpWebRequest PUTRequest;

System.Net.HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

static void Main(string[] args)

{

Program obj = new Program();

obj.SendmailAttachment();

Console.ReadLine();

}

System.Net.HttpWebRequest PUTRequest;

System.Net.HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

Program obj = new Program();

obj.SendmailAttachment();

Console.ReadLine();

}

System.Net.HttpWebRequest PUTRequest;

System.Net.HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

Console.ReadLine();

}

System.Net.HttpWebRequest PUTRequest;

System.Net.HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

HttpWebRequest PUTRequest;

System.Net.HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

HttpWebRequest PUTRequest1;

System.Net.WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

WebResponse PUTResponse;

System.Net.WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

WebResponse PUTResponse1;

System.Net.HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

HttpWebRequest PROPPATCHRequest;

System.Net.WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

WebResponse PROPPATCHResponse;

System.Net.HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

HttpWebRequest MOVERequest;

System.Net.WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

WebResponse MOVEResponse;

System.Net.CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

CredentialCache MyCredentialCache;

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strMailboxURI = "http://Your Exchange Server Name/exchange/";

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strSubURI = "http://Your Exchange Server Name/exchange/";

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strTempURI = "http://Your Exchange Server Name/exchange/";

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strServer = "Your Exchange Server Name";

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strPassword = "Your password";

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strDomain = "Your domain name";

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strAlias = "Your username";

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strTo = "To address";

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strSubject = "Test";

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strText = "This message was sent using WebDAV";

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

string strBody = "";

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

byte[] bytes = null;

 

System.IO.Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

Stream PUTRequestStream = null;

public void Sendmail()

{

 

try

public void Sendmail()

{

 

try

try

{

// Build the mailbox URI.

// Build the mailbox URI.

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

 

// Build the submission URI for the message. If Secure

"http://" + strServer + "/exchange/" + strAlias;

 

// Build the submission URI for the message. If Secure

// Build the submission URI for the message. If Secure

// Sockets Layer (SSL) is set up on the server, use

// Sockets Layer (SSL) is set up on the server, use

// "https://" instead of "http://".

// "https://" instead of "http://".

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

// Build the temporary URI for the message. If SSL is set

"http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

// Build the temporary URI for the message. If SSL is set

"/##DavMailSubmissionURI##/";

// Build the temporary URI for the message. If SSL is set

// Build the temporary URI for the message. If SSL is set

// up on the server, use "https://" instead of "http://".

// up on the server, use "https://" instead of "http://".

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

 

// Construct the RFC 822 formatted body of the PUT request.

"http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

 

// Construct the RFC 822 formatted body of the PUT request.

".eml/";

 

// Construct the RFC 822 formatted body of the PUT request.

// Construct the RFC 822 formatted body of the PUT request.

// Note: If the From: header is included here,

// Note: If the From: header is included here,

// the MOVE method request will return a

// the MOVE method request will return a

// 403 (Forbidden) status. The From address will

// 403 (Forbidden) status. The From address will

// be generated by the Exchange server.

// be generated by the Exchange server.

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

"\n" + strText;

// Create a new CredentialCache object and fill it with the network

// Create a new CredentialCache object and fill it with the network

// credentials required to access the server.

// credentials required to access the server.

MyCredentialCache = new System.Net.CredentialCache();

MyCredentialCache.Add(new System.Uri(strMailboxURI),

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

 

// Create the HttpWebRequest object.

new System.Net.CredentialCache();

MyCredentialCache.Add(new System.Uri(strMailboxURI),

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

 

// Create the HttpWebRequest object.

new System.Uri(strMailboxURI),

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

 

// Create the HttpWebRequest object.

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

 

// Create the HttpWebRequest object.

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

 

// Create the HttpWebRequest object.

// Create the HttpWebRequest object.

PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

// Add the network credentials to the request.

HttpWebRequest)HttpWebRequest.Create(strTempURI);

// Add the network credentials to the request.

// Add the network credentials to the request.

PUTRequest.Credentials = MyCredentialCache;

// Specify the PUT method.

// Specify the PUT method.

PUTRequest.Method = "PUT";

// Encode the body using UTF-8.

"PUT";

// Encode the body using UTF-8.

// Encode the body using UTF-8.

bytes = Encoding.UTF8.GetBytes((string)strBody);

// Set the content header length. This must be

Encoding.UTF8.GetBytes((string)strBody);

// Set the content header length. This must be

// Set the content header length. This must be

// done before writing data to the request stream.

// done before writing data to the request stream.

PUTRequest.ContentLength = bytes.Length;

// Get a reference to the request stream.

// Get a reference to the request stream.

PUTRequestStream = PUTRequest.GetRequestStream();

// Write the message body to the request stream.

// Write the message body to the request stream.

PUTRequestStream.Write(bytes, 0, bytes.Length);

// Close the Stream object to release the connection

// Close the Stream object to release the connection

// for further use.

// for further use.

PUTRequestStream.Close();

// Set the Content-Type header to the RFC 822 message format.

// Set the Content-Type header to the RFC 822 message format.

PUTRequest.ContentType = "message/rfc822";

// PUT the message in the Drafts folder of the

"message/rfc822";

// PUT the message in the Drafts folder of the

// PUT the message in the Drafts folder of the

// sender's mailbox.

// sender's mailbox.

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

// Create the HttpWebRequest object.

HttpWebResponse)PUTRequest.GetResponse();

// Create the HttpWebRequest object.

// Create the HttpWebRequest object.

MOVERequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

// Add the network credentials to the request.

HttpWebRequest)HttpWebRequest.Create(strTempURI);

// Add the network credentials to the request.

// Add the network credentials to the request.

MOVERequest.Credentials = MyCredentialCache;

// Specify the MOVE method.

// Specify the MOVE method.

MOVERequest.Method = "MOVE";

// Set the Destination header to the

"MOVE";

// Set the Destination header to the

// Set the Destination header to the

// mail submission URI.

// mail submission URI.

MOVERequest.Headers.Add("Destination", strSubURI);

// Send the message by moving it from the Drafts folder of the

"Destination", strSubURI);

// Send the message by moving it from the Drafts folder of the

// Send the message by moving it from the Drafts folder of the

// sender's mailbox to the mail submission URI.

// sender's mailbox to the mail submission URI.

MOVEResponse = (System.Net.HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

// Clean up.

HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

// Clean up.

Console.WriteLine("Message successfully sent.");

// Clean up.

// Clean up.

PUTResponse.Close();

MOVEResponse.Close();

}

catch (Exception ex)

{

// Catch any exceptions. Any error codes from the PUT

catch (Exception ex)

{

// Catch any exceptions. Any error codes from the PUT

// Catch any exceptions. Any error codes from the PUT

// or MOVE method requests on the server will be caught

// or MOVE method requests on the server will be caught

// here, also.

// here, also.

Console.WriteLine(ex.Message);

}

}

public void SendmailAttachment()

{

try

{

System.IO.Stream PUTRequestStream = null;

System.IO.Stream PROPPATCHRequestStream = null;

System.IO.Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

Console.WriteLine(ex.Message);

}

}

public void SendmailAttachment()

{

try

{

System.IO.Stream PUTRequestStream = null;

System.IO.Stream PROPPATCHRequestStream = null;

System.IO.Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

public void SendmailAttachment()

{

try

{

System.IO.Stream PUTRequestStream = null;

System.IO.Stream PROPPATCHRequestStream = null;

System.IO.Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

try

{

System.IO.Stream PUTRequestStream = null;

System.IO.Stream PROPPATCHRequestStream = null;

System.IO.Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

Stream PUTRequestStream = null;

System.IO.Stream PROPPATCHRequestStream = null;

System.IO.Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

Stream PROPPATCHRequestStream = null;

System.IO.Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

Stream PUTRequestStream1 = null;

strMailboxURI = "http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"http://" + strServer + "/exchange/" + strAlias;

strSubURI = "http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"http://" + strServer + "/exchange/" + strAlias +

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"/##DavMailSubmissionURI##/";

strTempURI = "http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"http://" + strServer + "/exchange/" + strAlias + "/drafts/" +

strSubject + ".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

".eml/";

strBody = "To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"To: " + strTo + "\n" +

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"Subject: " + strSubject + "\n" +

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"Date: " + System.DateTime.Now +

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"X-Mailer: test mailer" + "\n" +

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"MIME-Version: 1.0" + "\n" +

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"Content-Type: text/plain;" + "\n" +

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"Charset = \"iso-8859-1\"" + "\n" +

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"Content-Transfer-Encoding: 7bit" + "\n" +

"\n" + strText;

//Put the email in the Drafts folder

"\n" + strText;

//Put the email in the Drafts folder

//Put the email in the Drafts folder

MyCredentialCache = new System.Net.CredentialCache();

MyCredentialCache.Add(new System.Uri(strMailboxURI),

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PUTRequest.Credentials = MyCredentialCache;

PUTRequest.Method = "PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

new System.Net.CredentialCache();

MyCredentialCache.Add(new System.Uri(strMailboxURI),

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PUTRequest.Credentials = MyCredentialCache;

PUTRequest.Method = "PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

new System.Uri(strMailboxURI),

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PUTRequest.Credentials = MyCredentialCache;

PUTRequest.Method = "PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

"Basic",

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PUTRequest.Credentials = MyCredentialCache;

PUTRequest.Method = "PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

new System.Net.NetworkCredential(strAlias, strPassword, strDomain)

);

PUTRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PUTRequest.Credentials = MyCredentialCache;

PUTRequest.Method = "PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

HttpWebRequest)HttpWebRequest.Create(strTempURI);

PUTRequest.Credentials = MyCredentialCache;

PUTRequest.Method = "PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

"PUT";

bytes = Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

Encoding.UTF8.GetBytes((string)strBody);

PUTRequest.ContentLength = bytes.Length;

PUTRequestStream = PUTRequest.GetRequestStream();

PUTRequestStream.Write(bytes, 0, bytes.Length );

PUTRequestStream.Close();

PUTRequest.ContentType = "message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

"message/rfc822";

PUTResponse = (System.Net.HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

HttpWebResponse)PUTRequest.GetResponse();

//Do the PROPPATCH

//Do the PROPPATCH

string strxml = "<?xml version='1.0'?>" +

"<d:propertyupdate xmlns:d='DAV:'>" +

"<d:set>" +

"<d:prop>" +

"<isCollection xmlns='DAV:'>False</isCollection>" +

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

string strxml = "<?xml version='1.0'?>" +

"<d:propertyupdate xmlns:d='DAV:'>" +

"<d:set>" +

"<d:prop>" +

"<isCollection xmlns='DAV:'>False</isCollection>" +

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"<d:propertyupdate xmlns:d='DAV:'>" +

"<d:set>" +

"<d:prop>" +

"<isCollection xmlns='DAV:'>False</isCollection>" +

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"<d:set>" +

"<d:prop>" +

"<isCollection xmlns='DAV:'>False</isCollection>" +

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"<d:prop>" +

"<isCollection xmlns='DAV:'>False</isCollection>" +

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"<isCollection xmlns='DAV:'>False</isCollection>" +

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"</d:prop>" +

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"</d:set>" +

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"</d:propertyupdate>";

PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

HttpWebRequest)HttpWebRequest.Create(strTempURI);

PROPPATCHRequest.Credentials = MyCredentialCache;

PROPPATCHRequest.Headers.Set("Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"Translate", "f");

PROPPATCHRequest.ContentType = "text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"text/xml";

PROPPATCHRequest.ContentLength = strxml.Length;

PROPPATCHRequest.Method = "PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

"PROPPATCH";

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

byte[] PROPPATCHbytes = Encoding.UTF8.GetBytes(strxml);

PROPPATCHRequest.ContentLength = PROPPATCHbytes.Length;

PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

PROPPATCHRequestStream.Write(PROPPATCHbytes, 0, PROPPATCHbytes.Length);

PROPPATCHRequestStream.Close();

PROPPATCHResponse =

(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

HttpWebResponse)PROPPATCHRequest.GetResponse();

//Attach File: This could be put in a loop to attach more than one file.

//Attach File: This could be put in a loop to attach more than one file.

string FileName = @"D:\Pranaya\test.txt";

string attachURI = strTempURI + FileName;

PUTRequest1 = (System.Net.HttpWebRequest)HttpWebRequest.Create(attachURI);

PUTRequest1.Credentials = MyCredentialCache;

PUTRequest1.Method = "PUT";

System.IO.FileStream inFile;

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

string FileName = @"D:\Pranaya\test.txt";

string attachURI = strTempURI + FileName;

PUTRequest1 = (System.Net.HttpWebRequest)HttpWebRequest.Create(attachURI);

PUTRequest1.Credentials = MyCredentialCache;

PUTRequest1.Method = "PUT";

System.IO.FileStream inFile;

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

string attachURI = strTempURI + FileName;

PUTRequest1 = (System.Net.HttpWebRequest)HttpWebRequest.Create(attachURI);

PUTRequest1.Credentials = MyCredentialCache;

PUTRequest1.Method = "PUT";

System.IO.FileStream inFile;

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

HttpWebRequest)HttpWebRequest.Create(attachURI);

PUTRequest1.Credentials = MyCredentialCache;

PUTRequest1.Method = "PUT";

System.IO.FileStream inFile;

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

"PUT";

System.IO.FileStream inFile;

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

FileStream inFile;

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

byte[] binaryData;

inFile = new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

new System.IO.FileStream(FileName , System.IO.FileMode.Open, System.IO.FileAccess.Read);

binaryData = new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

new Byte[inFile.Length];

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

inFile.Close();

PUTRequest1.ContentLength = binaryData.Length;

PUTRequestStream1 = PUTRequest1.GetRequestStream();

PUTRequestStream1.Write(binaryData, 0, binaryData.Length);

PUTRequestStream1.Close();

PUTResponse1 = (System.Net.HttpWebResponse)PUTRequest1.GetResponse();

//Move File

HttpWebResponse)PUTRequest1.GetResponse();

//Move File

//Move File

MOVERequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(strTempURI);

MOVERequest.Credentials = MyCredentialCache;

MOVERequest.Method = "MOVE";

MOVERequest.Headers.Add("Destination", strSubURI);

MOVEResponse = (System.Net.HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

HttpWebRequest)HttpWebRequest.Create(strTempURI);

MOVERequest.Credentials = MyCredentialCache;

MOVERequest.Method = "MOVE";

MOVERequest.Headers.Add("Destination", strSubURI);

MOVEResponse = (System.Net.HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

"MOVE";

MOVERequest.Headers.Add("Destination", strSubURI);

MOVEResponse = (System.Net.HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

"Destination", strSubURI);

MOVEResponse = (System.Net.HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

HttpWebResponse)MOVERequest.GetResponse();

Console.WriteLine("Message successfully sent.");

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

Console.WriteLine("Message successfully sent.");

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

}

}

Console.WriteLine(ex.Message);

}

}

}

}

Published Tuesday, October 07, 2008 7:07 AM by pranayabsingh

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Enter the code you see below

Submit

About pranayabsingh

I Pranaya Kumar Baliyarsingh, having 7+ years of professional experience in the Information Technology Industry. My experience includes Project Management, Database Designing, Application Coding and Development, applies development standards and methodology such as using Framework and Object Oriented methodologies. I specialized in the areas of application design in client/server, distributed (Web and Multi-tier Client/Server) methodologies. Have the ability to quickly master new concepts of application, excellent communication and interpersonal skills and equally be proud to be a team member interested in emerging technologies.

This Blog

Syndication

Tags

No tags have been created or used yet.

Archives