Getting a particular message
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook Forum
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Getting a particular message
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
wannaknowmore
Guest





Posted: Mon Oct 31, 2005 5:58 pm    Post subject: Getting a particular message Reply with quote

Hello,
I have managed to get a list of messages and can get the description
and everything just fine.
But when i try to narrow down the search to return a single message the
message comes back with "HTTP Error 400 - Request is badly formed.".The
query that does not work is below ... if I comment out the href
condition then it works fine.
Any suggestions friends?

string strXML = "<?xml version='1.0' ?>"
+ "<a:searchrequest xmlns:a='DAV:'><a:sql>"
+ "SELECT"
+ " \"DAV:href\""
+ ",\"DAV:uid\""
+ ",\"DAV:creationdate\""
+ ",\"urn:schemas:httpmail:subject\""
+ ",\"http://schemas.microsoft.com/exchange/permanenturl\""
+ ",\"urn:schemas:httpmail:hasattachment\""
+ ",\"urn:schemas:httpmail:read\""
+ ",\"urn:schemas:httpmail:textdescription\""
// + ",\"urn:schemas:httpmail:attachmentfilename\""
+ " FROM scope('shallow traversal of \"\"')"
+ " WHERE \"DAV:ishidden\"=False"
+ " AND \"DAV:isfolder\"=False"
+ " AND \"DAV:href\"=\"" +
"https://companyaddress/exchange/test_commons.EML" + "\""
// + " AND \"urn:schemas:httpmail:read\"=False"
+ " ORDER BY \"DAV:creationdate\""
+ "</a:sql></a:searchrequest>" ;

basically how do I get a particular message using a condition like
where href = or where uid = ?

Back to top
Glen Scales [MVP]
Guest





Posted: Tue Nov 01, 2005 1:58 am    Post subject: Re: Getting a particular message Reply with quote

If you already know what the HREF value is why are you searching for it
these values are always going to be unique within the folder your searching
in. If you want to get the content of that particular item at that href then
it would be better using a Propfind to retrieve the properties your after or
maybe just get the stream of the item eg
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_exch2k_getting_an_items_stream_http.asp .
If you still want to search using the Dav:href have a read of the discussion
http://groups.google.com.au/group/microsoft.public.webstoragesystem.sdk.eng/browse_frm/thread/7d897373dbe8c2ad/cb14cf110ef1faba?lnk=st&q=search+dav:href&rnum=5&hl=en#cb14cf110ef1faba

Cheers
Glen

"wannaknowmore" <justsubscribe@gmail.com> wrote in message
news:1130780164.348922.119840@f14g2000cwb.googlegroups.com...
Quote:
Hello,
I have managed to get a list of messages and can get the description
and everything just fine.
But when i try to narrow down the search to return a single message the
message comes back with "HTTP Error 400 - Request is badly formed.".The
query that does not work is below ... if I comment out the href
condition then it works fine.
Any suggestions friends?

string strXML = "<?xml version='1.0' ?>"
+ "<a:searchrequest xmlns:a='DAV:'><a:sql>"
+ "SELECT"
+ " \"DAV:href\""
+ ",\"DAV:uid\""
+ ",\"DAV:creationdate\""
+ ",\"urn:schemas:httpmail:subject\""
+ ",\"http://schemas.microsoft.com/exchange/permanenturl\""
+ ",\"urn:schemas:httpmail:hasattachment\""
+ ",\"urn:schemas:httpmail:read\""
+ ",\"urn:schemas:httpmail:textdescription\""
// + ",\"urn:schemas:httpmail:attachmentfilename\""
+ " FROM scope('shallow traversal of \"\"')"
+ " WHERE \"DAV:ishidden\"=False"
+ " AND \"DAV:isfolder\"=False"
+ " AND \"DAV:href\"=\"" +
"https://companyaddress/exchange/test_commons.EML" + "\""
// + " AND \"urn:schemas:httpmail:read\"=False"
+ " ORDER BY \"DAV:creationdate\""
+ "</a:sql></a:searchrequest>" ;

basically how do I get a particular message using a condition like
where href = or where uid = ?
Back to top
wannaknowmore
Guest





Posted: Tue Nov 01, 2005 9:05 am    Post subject: Re: Getting a particular message Reply with quote

Thanks for the response Glen and the discussion link. I have some
specific concerns, kindly respond:
"already know what the HREF value is why are you searching for it " - I
get a list of HREFs based on my criteria and then retrieve more details
about each message separately.

1. "these values are always going to be unique within the folder" - The
HREF is formed based on the subject. What if I have two or more emails
with the same subject in the same folder? Then their HREF will still be
the same? Then?
2. "get the stream of the item " - but how do I get the different
properties from the stream - like from, to, subject etc.?

Please let em know,
Rahul
Back to top
Henning Krause [MVP - Exc
Guest





Posted: Tue Nov 01, 2005 9:58 am    Post subject: Re: Getting a particular message Reply with quote

Hello Rahul,

if you got a href from another SEARCH command, thats it. You can use that
url to access the item. The name of the message within the folder is
generated by Exchange or Outlook upon creation of the message. So, if there
are several messages with the same subject, they will have different urls.

To get the content, you have two options, as Glen already pointed out:
To get the entire content as MIME encoded mail, use the GET method
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_exch2k_getting_an_items_stream_http.asp).

To get exactly one or more properties in a more structured way, use the
PROPFIND command
(http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_webdav_propfind.asp).
You can find an overview of available properties hiere:
http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_exch2k_urn_content-classes_message.asp

Greetings,
Henning Krause
MVP - Exchange
http://www.infinitec.de


"wannaknowmore" <justsubscribe@gmail.com> wrote in message
news:1130814338.014251.259730@g43g2000cwa.googlegroups.com...
Quote:
Thanks for the response Glen and the discussion link. I have some
specific concerns, kindly respond:
"already know what the HREF value is why are you searching for it " - I
get a list of HREFs based on my criteria and then retrieve more details
about each message separately.

1. "these values are always going to be unique within the folder" - The
HREF is formed based on the subject. What if I have two or more emails
with the same subject in the same folder? Then their HREF will still be
the same? Then?
2. "get the stream of the item " - but how do I get the different
properties from the stream - like from, to, subject etc.?

Please let em know,
Rahul
Back to top
wannaknowmore
Guest





Posted: Thu Nov 03, 2005 1:47 am    Post subject: Re: Getting a particular message Reply with quote

" There is no excuse for being lazy and not finding it out yourself" -
I understand that; but can someone please show me a piece of code that
shows how to get the Body, subject, other properties from "MIME encoded
mail" that is returned from the GET method please. I have figured out
the other way but would like to compare.
Thanks for all the help.
Back to top
Henning Krause [MVP - Exc
Guest





Posted: Thu Nov 03, 2005 1:58 am    Post subject: Re: Getting a particular message Reply with quote

Hello,

what you get is really nothing more than a text file. See
http://www.ietf.org/rfc/rfc2822.txt (and http://www.ietf.org/rfc/rfc1521.txt
for mails with attachments) for the structure of an email. Basically you
have the header of the mail with "name: value" pairs like
Subject: foo bar
From: "Someone" someone@example.com

An empty line divides the header and the body. Thats it...

Greetings,
Henning Krause
MVP - Exchange
http://www.infinitec.de


"wannaknowmore" <justsubscribe@gmail.com> wrote in message
news:1130960831.083905.125380@g47g2000cwa.googlegroups.com...
Quote:
" There is no excuse for being lazy and not finding it out yourself" -
I understand that; but can someone please show me a piece of code that
shows how to get the Body, subject, other properties from "MIME encoded
mail" that is returned from the GET method please. I have figured out
the other way but would like to compare.
Thanks for all the help.
Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Access Forum - Dedicated Servers

Contact Us Powered by phpBB