We are using WebDAV to extract and save Exchange users EML files off. I
have run into a problem when I try and get a list of emails within a
folder. We use the following…
strQuery = "<?xml version=\"1.0\"?><D:searchrequest xmlns:D = \"DAV:\" >"
+ "<D:sql>SELECT \"DAV:href\", \"DAV:contentclass\", \"urn:schemas:mailheader:message-id\" "
+ "FROM \"" + strRootURI + "\""
+ "WHERE \"DAV:ishidden\" = false AND \"DAV:isfolder\" = false"
+ "</D:sql></D:searchrequest>";
And from that we get the XMLNodeLists…
hrefNodes = ResponseXmlDoc.GetElementsByTagName("a:href");
ContentClassNodes = ResponseXmlDoc.GetElementsByTagName("a:contentclass");
MailHeaderMessageIDNodes = ResponseXmlDoc.GetElementsByTagName("d:message-id");
if(hrefNodes.Count > 0)
{
// Loop through the display name nodes.
for(int i=0; i<hrefNodes.Count; i++)
{
string strClass = ContentClassNodes.Item(i).InnerText;
string strURL = hrefNodes.Item(i).InnerText;
string strMsgID = MailHeaderMessageIDNodes.Item(i).InnerText;
// If this is a message save the EML off into the table
if (strClass.CompareTo("urn:content-classes:message") == 0)
{
SaveLetter(strURL, strMsgID, strUserName, strPassword,
strDomain, strServer, conn);
}
}
}
The problem is that the count for the hrefNodes always seems to be double
the other 2. For example if I have 25 letters in a folder,
hrefNodes.Count is 50 and the other 2 show as 25. Is there a reason for
this?
Thank You,
Thomas Delany
(for David Marcil)
Glen Scales [MVP] - 14 Mar 2006 23:04 GMT
Try removing DAV:href from your select query it will be returned regardless
but I found that if you do include it then you end up with duplicates like
your experiencing
Cheers
Glen
> We are using WebDAV to extract and save Exchange users EML files off. I
> have run into a problem when I try and get a list of emails within a
[quoted text clipped - 41 lines]
> Thomas Delany
> (for David Marcil)