Click to See Complete Forum and Search --> : Invalid Handle error with XmlHttp


Shivonne
March 2nd, 2005, 04:37 AM
Hi all

I am trying to execute a WebDAV query against a webmail Exchange inbox using XMLHttp but I keep getting an error stating "The handle is invalid" when I call the send() method.

My code is as follows:

CODE
MSXML2.ServerXMLHTTP40Class xmlHttp = new ServerXMLHTTP40Class();
string folderQuery = "<?xml version=\"1.0\"?>" +
"<g:searchrequest xmlns:g=\"DAV:\">" +
"<g:sql>SELECT TOP 1 \"urn:schemas:httpmail:subject\", " +
"\"urn:schemas:httpmail:from\", \"DAV:displayname\", " +
"\"urn:schemas:httpmail:textdescription\" " +
"FROM SCOPE('shallow traversal of \"" + serverUrl + "\"') " +
"WHERE \"DAV:ishidden\" = False AND \"DAV:isfolder\" = False " +
"AND \"urn:schemas:httpmail:subject\" LIKE '%" +
"Undeliverable" +
"%' " +
"ORDER BY \"urn:schemas:httpmail:date\" DESC" +
"</g:sql></g:searchrequest>";

// Open a connection to the exchange server.
xmlHttp.open("PROPFIND", serverUrl, false, userName, password);
// Send the request.
xmlHttp.setRequestHeader("SQL", folderQuery);
xmlHttp.setRequestHeader("Content-type", "text/xml");
xmlHttp.setRequestHeader("Depth", "1");
xmlHttp.send(null);

I've tried browsing to the URL in IE and I can access the inbox with the username and password.

Can anyone help me with this, please?

Thanks as always