|
|
|
date: Wed, 13 Jul 2005 13:20:02 -0700,
group: microsoft.public.exchange2000.development
back
SQL Error in XML
I am creating a SQL SELECT statement and sending it to Exchange using WebDAV.
When I build the SELECT statement in my code (an XML document) and send it,
everything works perfect. If I save the XML document so I can simply load it
and use the SELECT statement again in the future, it fails.
I know this is caused by the "<>" sign in my WHERE clause. XML saves it as
< > Thus when it reads it back it somehow fails as I don't think it's
interpetting it correctly.
Here is the XML of my SELECT statement:
<?xml version="1.0"?>
<searchrequest xmlns="DAV:"><sql>SELECT "DAV:displayname", "DAV:href",
"DAV:uid", "http://schemas.microsoft.com/exchange/outlookmessageclass",
"urn:schemas:httpmail:hasattachment", "urn:schemas:httpmail:from",
"urn:schemas:httpmail:date", "urn:schemas:httpmail:textdescription" FROM
"http://flspexuser02/exchange/AWDCustomEmail/inbox" WHERE "DAV:ishidden" =
false AND "DAV:isfolder" = false AND "urn:schemas:httpmail:read" = false AND
"http://schemas.microsoft.com/exchange/outlookmessageclass" <>
'IPM.Note.Rules.OofTemplate.Microsoft' AND
"http://schemas.microsoft.com/exchange/outlookmessageclass" <>
'REPORT.IPM.Note.NDR'</sql></searchrequest>
I get this result back.
Status: 502 - Bad Gateway
Status text: An error occurred on the server.
Notice the < > in the WHERE clause. The XML is correct. Why doesn't this
work?
Thank you,
Frank
date: Wed, 13 Jul 2005 13:20:02 -0700
author: Frank
Re: SQL Error in XML
Instead of using <> for inequality try using != which shouldn't cause any
problems for the parser.
Cheers
Glen
"Frank" wrote in message
news:889CFD67-75B0-492E-8D4E-25DB8CAA1A10@microsoft.com...
>I am creating a SQL SELECT statement and sending it to Exchange using
>WebDAV.
> When I build the SELECT statement in my code (an XML document) and send
> it,
> everything works perfect. If I save the XML document so I can simply load
> it
> and use the SELECT statement again in the future, it fails.
>
> I know this is caused by the "<>" sign in my WHERE clause. XML saves it
> as
> < > Thus when it reads it back it somehow fails as I don't think it's
> interpetting it correctly.
>
> Here is the XML of my SELECT statement:
>
> <?xml version="1.0"?>
> <searchrequest xmlns="DAV:"><sql>SELECT "DAV:displayname", "DAV:href",
> "DAV:uid", "http://schemas.microsoft.com/exchange/outlookmessageclass",
> "urn:schemas:httpmail:hasattachment", "urn:schemas:httpmail:from",
> "urn:schemas:httpmail:date", "urn:schemas:httpmail:textdescription" FROM
> "http://flspexuser02/exchange/AWDCustomEmail/inbox" WHERE "DAV:ishidden" =
> false AND "DAV:isfolder" = false AND "urn:schemas:httpmail:read" = false
> AND
> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
> 'IPM.Note.Rules.OofTemplate.Microsoft' AND
> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
> 'REPORT.IPM.Note.NDR'</sql></searchrequest>
>
> I get this result back.
> Status: 502 - Bad Gateway
> Status text: An error occurred on the server.
>
> Notice the < > in the WHERE clause. The XML is correct. Why doesn't this
> work?
>
> Thank you,
>
> Frank
date: Mon, 18 Jul 2005 10:00:11 +1000
author: Glen Scales [MVP]
Re: SQL Error in XML
"502 Bad Gateway" is indicative that the URI used in the FROM clashes with
one or more other paths in the request. Try:
SEARCH /path-you-want-to-search/
<?xml version="1.0"?>
<searchrequest xmlns="DAV:">
[...]
FROM Scope('SHALLOW TRAVERSAL OF ""')
[...]
</searchrequest>
This'll return results from the 'path-you-want-to-search' folder, which you
could swap with '/exchange/AWDCustomEmail/inbox/'.
As an FYI, returning 'textdescription' as a column in a SEARCH is an
incredibly CPU-intensive proposition - and generally a bad idea. You will
be causing any message with a body not stored as text (i.e. RTF or HTML) to
be converted before the response can be returned. You might consider going
after PR_PREVIEW (http://schemas.microsoft.com/mapi/proptag/x3fd9001f via
WebDAV) which gives you the pre-calculated 3-line preview of Outlook...
Regards,
- Karim
"Glen Scales [MVP]" wrote in message
news:u93$suyiFHA.3540@TK2MSFTNGP14.phx.gbl...
> Instead of using <> for inequality try using != which shouldn't cause any
> problems for the parser.
>
> Cheers
> Glen
>
> "Frank" wrote in message
> news:889CFD67-75B0-492E-8D4E-25DB8CAA1A10@microsoft.com...
>>I am creating a SQL SELECT statement and sending it to Exchange using
>>WebDAV.
>> When I build the SELECT statement in my code (an XML document) and send
>> it,
>> everything works perfect. If I save the XML document so I can simply
>> load it
>> and use the SELECT statement again in the future, it fails.
>>
>> I know this is caused by the "<>" sign in my WHERE clause. XML saves it
>> as
>> < > Thus when it reads it back it somehow fails as I don't think it's
>> interpetting it correctly.
>>
>> Here is the XML of my SELECT statement:
>>
>> <?xml version="1.0"?>
>> <searchrequest xmlns="DAV:"><sql>SELECT "DAV:displayname", "DAV:href",
>> "DAV:uid", "http://schemas.microsoft.com/exchange/outlookmessageclass",
>> "urn:schemas:httpmail:hasattachment", "urn:schemas:httpmail:from",
>> "urn:schemas:httpmail:date", "urn:schemas:httpmail:textdescription" FROM
>> "http://flspexuser02/exchange/AWDCustomEmail/inbox" WHERE "DAV:ishidden"
>> =
>> false AND "DAV:isfolder" = false AND "urn:schemas:httpmail:read" = false
>> AND
>> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
>> 'IPM.Note.Rules.OofTemplate.Microsoft' AND
>> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
>> 'REPORT.IPM.Note.NDR'</sql></searchrequest>
>>
>> I get this result back.
>> Status: 502 - Bad Gateway
>> Status text: An error occurred on the server.
>>
>> Notice the < > in the WHERE clause. The XML is correct. Why doesn't
>> this
>> work?
>>
>> Thank you,
>>
>> Frank
>
>
date: Mon, 18 Jul 2005 14:21:49 -0700
author: Karim Batthish [MS]
Re: SQL Error in XML
Thank you Karim. I will give that a try. You mentioned not using the
"textdescription" in my search, however I must get the entire body (text) of
the emails I'm retrieving. I'm having to take these emails and place them
into our workflow management system. In fact I must get the plain text and
can't use any HTML, etc... Is there another way or another property besides
just the preview lines?
I've used Henning Krause's Mistaya program to see what else is available and
don't see anything. In fact sometimes I don't even see the property
"textdescription" in the "urn:schemas:httpmail:" namespace where it's found
(only on some emails). However, when I do the search it always comes back
for all the emails.
Thank you very much for your help.
"Karim Batthish [MS]" wrote:
> "502 Bad Gateway" is indicative that the URI used in the FROM clashes with
> one or more other paths in the request. Try:
>
> SEARCH /path-you-want-to-search/
>
> <?xml version="1.0"?>
> <searchrequest xmlns="DAV:">
> [...]
> FROM Scope('SHALLOW TRAVERSAL OF ""')
> [...]
> </searchrequest>
>
> This'll return results from the 'path-you-want-to-search' folder, which you
> could swap with '/exchange/AWDCustomEmail/inbox/'.
>
> As an FYI, returning 'textdescription' as a column in a SEARCH is an
> incredibly CPU-intensive proposition - and generally a bad idea. You will
> be causing any message with a body not stored as text (i.e. RTF or HTML) to
> be converted before the response can be returned. You might consider going
> after PR_PREVIEW (http://schemas.microsoft.com/mapi/proptag/x3fd9001f via
> WebDAV) which gives you the pre-calculated 3-line preview of Outlook...
>
> Regards,
> - Karim
>
>
> "Glen Scales [MVP]" wrote in message
> news:u93$suyiFHA.3540@TK2MSFTNGP14.phx.gbl...
> > Instead of using <> for inequality try using != which shouldn't cause any
> > problems for the parser.
> >
> > Cheers
> > Glen
> >
> > "Frank" wrote in message
> > news:889CFD67-75B0-492E-8D4E-25DB8CAA1A10@microsoft.com...
> >>I am creating a SQL SELECT statement and sending it to Exchange using
> >>WebDAV.
> >> When I build the SELECT statement in my code (an XML document) and send
> >> it,
> >> everything works perfect. If I save the XML document so I can simply
> >> load it
> >> and use the SELECT statement again in the future, it fails.
> >>
> >> I know this is caused by the "<>" sign in my WHERE clause. XML saves it
> >> as
> >> < > Thus when it reads it back it somehow fails as I don't think it's
> >> interpetting it correctly.
> >>
> >> Here is the XML of my SELECT statement:
> >>
> >> <?xml version="1.0"?>
> >> <searchrequest xmlns="DAV:"><sql>SELECT "DAV:displayname", "DAV:href",
> >> "DAV:uid", "http://schemas.microsoft.com/exchange/outlookmessageclass",
> >> "urn:schemas:httpmail:hasattachment", "urn:schemas:httpmail:from",
> >> "urn:schemas:httpmail:date", "urn:schemas:httpmail:textdescription" FROM
> >> "http://flspexuser02/exchange/AWDCustomEmail/inbox" WHERE "DAV:ishidden"
> >> =
> >> false AND "DAV:isfolder" = false AND "urn:schemas:httpmail:read" = false
> >> AND
> >> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
> >> 'IPM.Note.Rules.OofTemplate.Microsoft' AND
> >> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
> >> 'REPORT.IPM.Note.NDR'</sql></searchrequest>
> >>
> >> I get this result back.
> >> Status: 502 - Bad Gateway
> >> Status text: An error occurred on the server.
> >>
> >> Notice the < > in the WHERE clause. The XML is correct. Why doesn't
> >> this
> >> work?
> >>
> >> Thank you,
> >>
> >> Frank
> >
> >
>
>
>
date: Thu, 28 Jul 2005 19:33:04 -0700
author: Frank
Re: SQL Error in XML
My suggestion would be to use SEARCH on the criteria you desire, get back
the DAV:href values, then loop through the response issue sequential
PROPFIND (or GET) requests against each DAV:href to get those 'expensive'
(and other) properties.
As I mentioned, the Exchange Store will persist only the *best* body part
available when a message is delivered, be it text, RTF or HTML. When asking
for urn:schemas:httpmail:textdescription, the Store will return the value
immediately if a text body is actually present, else it will convert the
persisted RTF or HTML to text to provide the response. As you might
imagine, calculating and returning a (potentially large!) text body for each
row returned in the SEARCH response will likely put a significant load on
the server to complete a single request. The suggestion above helps to
break up the load of conversion and retrieve large streams across multiple
requests and shouldn't be much additional burden to code.
Regards,
- Karim
"Frank" wrote in message
news:10953362-7C9E-4C36-A15A-03D2A235B77C@microsoft.com...
> Thank you Karim. I will give that a try. You mentioned not using the
> "textdescription" in my search, however I must get the entire body (text)
> of
> the emails I'm retrieving. I'm having to take these emails and place them
> into our workflow management system. In fact I must get the plain text
> and
> can't use any HTML, etc... Is there another way or another property
> besides
> just the preview lines?
>
> I've used Henning Krause's Mistaya program to see what else is available
> and
> don't see anything. In fact sometimes I don't even see the property
> "textdescription" in the "urn:schemas:httpmail:" namespace where it's
> found
> (only on some emails). However, when I do the search it always comes back
> for all the emails.
>
> Thank you very much for your help.
>
> "Karim Batthish [MS]" wrote:
>
>> "502 Bad Gateway" is indicative that the URI used in the FROM clashes
>> with
>> one or more other paths in the request. Try:
>>
>> SEARCH /path-you-want-to-search/
>>
>> <?xml version="1.0"?>
>> <searchrequest xmlns="DAV:">
>> [...]
>> FROM Scope('SHALLOW TRAVERSAL OF ""')
>> [...]
>> </searchrequest>
>>
>> This'll return results from the 'path-you-want-to-search' folder, which
>> you
>> could swap with '/exchange/AWDCustomEmail/inbox/'.
>>
>> As an FYI, returning 'textdescription' as a column in a SEARCH is an
>> incredibly CPU-intensive proposition - and generally a bad idea. You
>> will
>> be causing any message with a body not stored as text (i.e. RTF or HTML)
>> to
>> be converted before the response can be returned. You might consider
>> going
>> after PR_PREVIEW (http://schemas.microsoft.com/mapi/proptag/x3fd9001f via
>> WebDAV) which gives you the pre-calculated 3-line preview of Outlook...
>>
>> Regards,
>> - Karim
>>
>>
>> "Glen Scales [MVP]" wrote in message
>> news:u93$suyiFHA.3540@TK2MSFTNGP14.phx.gbl...
>> > Instead of using <> for inequality try using != which shouldn't cause
>> > any
>> > problems for the parser.
>> >
>> > Cheers
>> > Glen
>> >
>> > "Frank" wrote in message
>> > news:889CFD67-75B0-492E-8D4E-25DB8CAA1A10@microsoft.com...
>> >>I am creating a SQL SELECT statement and sending it to Exchange using
>> >>WebDAV.
>> >> When I build the SELECT statement in my code (an XML document) and
>> >> send
>> >> it,
>> >> everything works perfect. If I save the XML document so I can simply
>> >> load it
>> >> and use the SELECT statement again in the future, it fails.
>> >>
>> >> I know this is caused by the "<>" sign in my WHERE clause. XML saves
>> >> it
>> >> as
>> >> < > Thus when it reads it back it somehow fails as I don't think it's
>> >> interpetting it correctly.
>> >>
>> >> Here is the XML of my SELECT statement:
>> >>
>> >> <?xml version="1.0"?>
>> >> <searchrequest xmlns="DAV:"><sql>SELECT "DAV:displayname", "DAV:href",
>> >> "DAV:uid",
>> >> "http://schemas.microsoft.com/exchange/outlookmessageclass",
>> >> "urn:schemas:httpmail:hasattachment", "urn:schemas:httpmail:from",
>> >> "urn:schemas:httpmail:date", "urn:schemas:httpmail:textdescription"
>> >> FROM
>> >> "http://flspexuser02/exchange/AWDCustomEmail/inbox" WHERE
>> >> "DAV:ishidden"
>> >> =
>> >> false AND "DAV:isfolder" = false AND "urn:schemas:httpmail:read" =
>> >> false
>> >> AND
>> >> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
>> >> 'IPM.Note.Rules.OofTemplate.Microsoft' AND
>> >> "http://schemas.microsoft.com/exchange/outlookmessageclass" <>
>> >> 'REPORT.IPM.Note.NDR'</sql></searchrequest>
>> >>
>> >> I get this result back.
>> >> Status: 502 - Bad Gateway
>> >> Status text: An error occurred on the server.
>> >>
>> >> Notice the < > in the WHERE clause. The XML is correct. Why doesn't
>> >> this
>> >> work?
>> >>
>> >> Thank you,
>> >>
>> >> Frank
>> >
>> >
>>
>>
>>
date: Tue, 2 Aug 2005 12:11:48 -0700
author: Karim Batthish [MS]
|
|