Hello, I'm using the following query to locate incoming messages on a mailbox: Dim urlInbox As String = "http://myserver/Exchange/mymailbox/Inbox/" Dim adoCnx As New ADODB.Connection adoCnx.Provider = "MSDAIPP.DSO" adoCnx.Open(urlInbox) Dim adoRsMsgs As New ADODB.Recordset adoRsMsgs.ActiveConnection = adoCnx Dim strSQL As String = _ "SELECT ""urn:schemas:httpmail:subject"", " & _ """urn:schemas:mailheader:date"", " & _ """urn:schemas:httpmail:textdescription"" " & _ "FROM """ & urlInbox & """ " & _ "WHERE ""urn:schemas:httpmail:subject"" = 'MO SMS delivery message' " & _ "ORDER BY ""urn:schemas:mailheader:date"" DESC" adoRsMsgs.Open(strSQL) Do While Not adoRsMsgs.EOF ... More processing here ... Loop This code doesn't work on other mailboxes (on which I have user permissions and can open both in Outlook and OWA). What am I missing? TIA
Do you get an errors when you run the code ? MSDAIPP.DSO use's webdav as the underlying mechanism to access the Exchange Store you might want to try a direct WebDAV query instead see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_exch2k_searching_folders_http.asp . This will allow you to see what errors are being generated if any. Cheers Glen wrote in message news:1140934582.194861.202760@j33g2000cwa.googlegroups.com... > Hello, > > I'm using the following query to locate incoming messages on a mailbox: > > Dim urlInbox As String = > "http://myserver/Exchange/mymailbox/Inbox/" > Dim adoCnx As New ADODB.Connection > adoCnx.Provider = "MSDAIPP.DSO" > adoCnx.Open(urlInbox) > Dim adoRsMsgs As New ADODB.Recordset > adoRsMsgs.ActiveConnection = adoCnx > Dim strSQL As String = _ > "SELECT ""urn:schemas:httpmail:subject"", " & _ > """urn:schemas:mailheader:date"", " & _ > """urn:schemas:httpmail:textdescription"" " & _ > "FROM """ & urlInbox & """ " & _ > "WHERE ""urn:schemas:httpmail:subject"" = 'MO SMS delivery > message' " & _ > "ORDER BY ""urn:schemas:mailheader:date"" DESC" > adoRsMsgs.Open(strSQL) > Do While Not adoRsMsgs.EOF > ... More processing here ... > Loop > > This code doesn't work on other mailboxes (on which I have user > permissions and can open both in Outlook and OWA). What am I missing? > > TIA >
Hi Glen, My code throws an exception on the Open() statement, but no details are given. I tried the code in the link and got a "The remote server returned an error: (501) Not Implemented." exception on the GetRequestStream() statement.
Oooops... I had a problem with my password. After fixing it the sample code at the link throws a "The remote server returned an error: (401) Unauthorized." exception when calling Request.GetResponse(). Sorry about that.
Opps 2... After some more tweaking the code now works for my own mailbox and some other mailboxes, but NOT on the mailbox I'm. Exception returned: "The remote server returned an error: (404) Not Found."
Problem solved. It took me some time to realize that the Inbox on that mailbox wasn't called "Inbox" but some other name. I fixed the URL and my code started working. Thanks a lot.