Felipe
2009-04-20 14:35:02 UTC
I have an application for Exchange 2003 and when I try to run with Exchange
2007 does not connect, display 404 timeout error in the next code:
System.Net.WebResponse objResponse = objHttpReq.GetResponse();
in the Exchange 2007 server, I remove the certified and the mailbox is
accessed via http://
This is the complete code for the connection:
strSearch = "<?xml version=\"1.0\"?>";
strSearch += "<a:searchrequest xmlns:a=\"DAV:\">";
strSearch += "<sql> SELECT
\"urn:schemas:httpmail:from\",\"urn:schemas:httpmail:subject\",\"urn:schemas:httpmail:textdescription\",\"urn:schemas:httpmail:hasattachment\",
\"DAV:contentclass\",\"DAV:displayname\",\"DAV:href\"";
strSearch += "FROM Scope('SHALLOW TRAVERSAL OF \"\"') ";
strSearch += "Where \"DAV:isfolder\" = false AND
\"DAV:contentclass\" ";
strSearch += "= 'urn:content-classes:message' AND
\"DAV:ishidden\"=false";
strSearch += "</>";
strSearch += "</>";
System.Uri objUri = new Uri(Url);
System.Net.HttpWebRequest objHttpReq;
System.Net.CredentialCache objCredenciales = new
System.Net.CredentialCache();
objCredenciales.Add(objUri, "NTLM", new
System.Net.NetworkCredential(Usuario, ContraseƱa, Dominio));
objHttpReq =
(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(objUri);
objHttpReq.Credentials = objCredenciales;
objHttpReq.Method = "SEARCH";
objHttpReq.ContentType = "text/xml";
byte[] objBytes = null;
objBytes = System.Text.Encoding.UTF8.GetBytes((string)strSearch);
objHttpReq.ContentLength = objBytes.Length;
System.IO.Stream objStreamRespuesta =
objHttpReq.GetRequestStream();
objStreamRespuesta.Write(objBytes, 0, objBytes.Length);
objStreamRespuesta.Close();
string strResultado = null;
try
{
System.Net.WebResponse objResponse = objHttpReq.GetResponse();
System.IO.Stream objXMLRespuesta =
objResponse.GetResponseStream();
System.IO.StreamReader objRespuesta = new
System.IO.StreamReader(objXMLRespuesta,
System.Text.Encoding.GetEncoding("utf-8"));
strResultado = objRespuesta.ReadToEnd();
}
catch { }
thanks for any cooperation
2007 does not connect, display 404 timeout error in the next code:
System.Net.WebResponse objResponse = objHttpReq.GetResponse();
in the Exchange 2007 server, I remove the certified and the mailbox is
accessed via http://
This is the complete code for the connection:
strSearch = "<?xml version=\"1.0\"?>";
strSearch += "<a:searchrequest xmlns:a=\"DAV:\">";
strSearch += "<sql> SELECT
\"urn:schemas:httpmail:from\",\"urn:schemas:httpmail:subject\",\"urn:schemas:httpmail:textdescription\",\"urn:schemas:httpmail:hasattachment\",
\"DAV:contentclass\",\"DAV:displayname\",\"DAV:href\"";
strSearch += "FROM Scope('SHALLOW TRAVERSAL OF \"\"') ";
strSearch += "Where \"DAV:isfolder\" = false AND
\"DAV:contentclass\" ";
strSearch += "= 'urn:content-classes:message' AND
\"DAV:ishidden\"=false";
strSearch += "</>";
strSearch += "</>";
System.Uri objUri = new Uri(Url);
System.Net.HttpWebRequest objHttpReq;
System.Net.CredentialCache objCredenciales = new
System.Net.CredentialCache();
objCredenciales.Add(objUri, "NTLM", new
System.Net.NetworkCredential(Usuario, ContraseƱa, Dominio));
objHttpReq =
(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(objUri);
objHttpReq.Credentials = objCredenciales;
objHttpReq.Method = "SEARCH";
objHttpReq.ContentType = "text/xml";
byte[] objBytes = null;
objBytes = System.Text.Encoding.UTF8.GetBytes((string)strSearch);
objHttpReq.ContentLength = objBytes.Length;
System.IO.Stream objStreamRespuesta =
objHttpReq.GetRequestStream();
objStreamRespuesta.Write(objBytes, 0, objBytes.Length);
objStreamRespuesta.Close();
string strResultado = null;
try
{
System.Net.WebResponse objResponse = objHttpReq.GetResponse();
System.IO.Stream objXMLRespuesta =
objResponse.GetResponseStream();
System.IO.StreamReader objRespuesta = new
System.IO.StreamReader(objXMLRespuesta,
System.Text.Encoding.GetEncoding("utf-8"));
strResultado = objRespuesta.ReadToEnd();
}
catch { }
thanks for any cooperation