|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
getting labels of appointments in calendari'm trying to list the appointments in an exchange calendar, using the following query string: string formatted = "<?xml version=\"1.0\"?>" + "<g:searchrequest xmlns:g=\"DAV:\">" + "<g:sql>SELECT \"urn:schemas:calendar:location \", \"urn:schemas:httpmail:subject\", " + "\"urn:schemas:calendar:dtstart\", \"urn:schemas:calendar:dtend\", " + "\"urn:schemas:calendar:priority\", \"urn:schemas:calendar:instancetype\" " + "FROM Scope('SHALLOW TRAVERSAL OF \"" + uri + "\"') " + "WHERE NOT \"urn:schemas:calendar:instancetype \" = 1 " + "AND \"DAV:contentclass\" = 'urn:content- classes:appointment' " + "AND \"urn:schemas:calendar:dtstart\" > '2003/06/01 00:00:00' " + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC" + "</g:sql></g:searchrequest>"; Works fine. Any ideas how to get the label (colouring) of the appointment? and what should the "TODO" field be for the colouring? XmlNodeList locationNodes = document.GetElementsByTagName("TODO"); Thanks a lot for the help, B To get the label colour of a calendar appointment you need to include the
following Mapi Named prop in your query http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/0x8214 . This will return a integer value that represents the color. You might what to use something like http://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/0x8214 as ApptColor in your query which will makes it easier to retrieve the namespace eg XmlNodeList locationNodes = document.GetElementsByTagName("ApptColor") The other thing to keep in mind is that Outlook 2007 / Exchange 2007 OWA's category colours are handled in a very different way. Cheers Glen Show quote "bart" <bjan***@etro.vub.ac.be> wrote in message news:1178108526.437882.88190@p77g2000hsh.googlegroups.com... > Hi all, > > i'm trying to list the appointments in an exchange calendar, using the > following query string: > > string formatted = "<?xml version=\"1.0\"?>" > + "<g:searchrequest xmlns:g=\"DAV:\">" > + "<g:sql>SELECT \"urn:schemas:calendar:location > \", \"urn:schemas:httpmail:subject\", " > + "\"urn:schemas:calendar:dtstart\", > \"urn:schemas:calendar:dtend\", " > + "\"urn:schemas:calendar:priority\", > \"urn:schemas:calendar:instancetype\" " > + "FROM Scope('SHALLOW TRAVERSAL OF \"" + uri + > "\"') " > + "WHERE NOT \"urn:schemas:calendar:instancetype > \" = 1 " > + "AND \"DAV:contentclass\" = 'urn:content- > classes:appointment' " > + "AND \"urn:schemas:calendar:dtstart\" > > '2003/06/01 00:00:00' " > + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC" > + "</g:sql></g:searchrequest>"; > > Works fine. Any ideas how to get the label (colouring) of the > appointment? > > and what should the "TODO" field be for the colouring? > > XmlNodeList locationNodes = document.GetElementsByTagName("TODO"); > > Thanks a lot for the help, > > B > Thanks a lot for the help.
Querying fot the property yoy mentioned, results in the exception: "Name cannot begin with the '0' character, hexadecimal value 0x30. Line 1, position 807", see code below. Is the query correct as I formulated it below? Thanks a lot, Bart string formatted = "<?xml version=\"1.0\"?>" + "<g:searchrequest xmlns:g=\"DAV:\">" + "<g:sql>SELECT \"urn:schemas:calendar:location \", \"urn:schemas:httpmail:subject\", " + "\"urn:schemas:calendar:dtstart\", \"urn:schemas:calendar:dtend\", " + "\"urn:schemas:calendar:priority\", \"urn:schemas:calendar:instancetype\" , " {00062002-0000-0000-C000-000000000046}/0x8214\" " + "FROM Scope('SHALLOW TRAVERSAL OF \"" + uri + "\"') " + "WHERE NOT \"urn:schemas:calendar:instancetype \" = 1 " + "AND \"DAV:contentclass\" = 'urn:content- classes:appointment' " + "AND \"urn:schemas:calendar:dtstart\" > '2003/06/01 00:00:00' " + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC" + "</g:sql></g:searchrequest>"; bytes = Encoding.UTF8.GetBytes(formatted); // Use the authorization cookies we stored in the authentication method. request = (HttpWebRequest)HttpWebRequest.Create(uri); request.CookieContainer = authCookies; request.Method = "SEARCH"; request.ContentLength = bytes.Length; request.ContentType = "text/xml"; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(bytes, 0, bytes.Length); requestStream.Close(); } response = (HttpWebResponse)request.GetResponse(); using (Stream responseStream = response.GetResponseStream()) { // Parse the XML response to find the data we need. XmlDocument document = new XmlDocument(); document.Load(responseStream); ==> Name cannot begin with the '0' character, hexadecimal value 0x30. Line 1, position 807 Show quote On May 3, 2:02 am, "Glen Scales [MVP]" <gsca***@outlookexchange.com> wrote: > To get the label colour of a calendar appointment you need to include the > following Mapi Named prop in your queryhttp://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/0x8214 . > This will return a integer value that represents the color. > > You might what to use something likehttp://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/0x8214 > as ApptColor in your query which will makes it easier to retrieve the > namespace eg XmlNodeList locationNodes = > document.GetElementsByTagName("ApptColor") > > The other thing to keep in mind is that Outlook 2007 / Exchange 2007 OWA's > category colours are handled in a very different way. > > Cheers > Glen > > "bart" <bjan***@etro.vub.ac.be> wrote in message > > news:1178108526.437882.88190@p77g2000hsh.googlegroups.com... > > > Hi all, > > > i'm trying to list the appointments in an exchange calendar, using the > > following query string: > > > string formatted = "<?xml version=\"1.0\"?>" > > + "<g:searchrequest xmlns:g=\"DAV:\">" > > + "<g:sql>SELECT \"urn:schemas:calendar:location > > \", \"urn:schemas:httpmail:subject\", " > > + "\"urn:schemas:calendar:dtstart\", > > \"urn:schemas:calendar:dtend\", " > > + "\"urn:schemas:calendar:priority\", > > \"urn:schemas:calendar:instancetype\" " > > + "FROM Scope('SHALLOW TRAVERSAL OF \"" + uri + > > "\"') " > > + "WHERE NOT \"urn:schemas:calendar:instancetype > > \" = 1 " > > + "AND \"DAV:contentclass\" = 'urn:content- > > classes:appointment' " > > + "AND \"urn:schemas:calendar:dtstart\" > > > '2003/06/01 00:00:00' " > > + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC" > > + "</g:sql></g:searchrequest>"; > > > Works fine. Any ideas how to get the label (colouring) of the > > appointment? > > > and what should the "TODO" field be for the colouring? > > > XmlNodeList locationNodes = document.GetElementsByTagName("TODO"); > > > Thanks a lot for the help, > > > B Hello,
that's a big problem with Exchange - it returns invalid xml when you are querying those properties. What I do in my Exchange library is to replace the invalid chars in the response document with a prefix and parse the result with an XmlReader. Best regards, Henning Krause Show quote "bart" <bjan***@etro.vub.ac.be> wrote in message news:1178178123.264517.265940@q75g2000hsh.googlegroups.com... > Thanks a lot for the help. > Querying fot the property yoy mentioned, results in the exception: > "Name cannot begin with the '0' character, hexadecimal value 0x30. > Line 1, position 807", see code below. > > Is the query correct as I formulated it below? > > Thanks a lot, Bart > > string formatted = "<?xml version=\"1.0\"?>" > + "<g:searchrequest xmlns:g=\"DAV:\">" > + "<g:sql>SELECT \"urn:schemas:calendar:location > \", \"urn:schemas:httpmail:subject\", " > + "\"urn:schemas:calendar:dtstart\", > \"urn:schemas:calendar:dtend\", " > + "\"urn:schemas:calendar:priority\", > \"urn:schemas:calendar:instancetype\" , " > + "\"http://schemas.microsoft.com/mapi/id/ > {00062002-0000-0000-C000-000000000046}/0x8214\" " > + "FROM Scope('SHALLOW TRAVERSAL OF \"" + uri + > "\"') " > + "WHERE NOT \"urn:schemas:calendar:instancetype > \" = 1 " > + "AND \"DAV:contentclass\" = 'urn:content- > classes:appointment' " > + "AND \"urn:schemas:calendar:dtstart\" > > '2003/06/01 00:00:00' " > + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC" > + "</g:sql></g:searchrequest>"; > > > bytes = Encoding.UTF8.GetBytes(formatted); > > // Use the authorization cookies we stored in the > authentication method. > > request = (HttpWebRequest)HttpWebRequest.Create(uri); > request.CookieContainer = authCookies; > > request.Method = "SEARCH"; > request.ContentLength = bytes.Length; > request.ContentType = "text/xml"; > > using (Stream requestStream = request.GetRequestStream()) > { > requestStream.Write(bytes, 0, bytes.Length); > requestStream.Close(); > } > > response = (HttpWebResponse)request.GetResponse(); > > using (Stream responseStream = > response.GetResponseStream()) > { > // Parse the XML response to find the data we need. > > XmlDocument document = new XmlDocument(); > document.Load(responseStream); > > ==> Name cannot begin with the '0' character, hexadecimal value 0x30. > Line 1, position 807 > > On May 3, 2:02 am, "Glen Scales [MVP]" <gsca***@outlookexchange.com> > wrote: >> To get the label colour of a calendar appointment you need to include the >> following Mapi Named prop in your >> queryhttp://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/0x8214 >> . >> This will return a integer value that represents the color. >> >> You might what to use something >> likehttp://schemas.microsoft.com/mapi/id/{00062002-0000-0000-C000-000000000046}/0x8214 >> as ApptColor in your query which will makes it easier to retrieve the >> namespace eg XmlNodeList locationNodes = >> document.GetElementsByTagName("ApptColor") >> >> The other thing to keep in mind is that Outlook 2007 / Exchange 2007 >> OWA's >> category colours are handled in a very different way. >> >> Cheers >> Glen >> >> "bart" <bjan***@etro.vub.ac.be> wrote in message >> >> news:1178108526.437882.88190@p77g2000hsh.googlegroups.com... >> >> > Hi all, >> >> > i'm trying to list the appointments in an exchange calendar, using the >> > following query string: >> >> > string formatted = "<?xml version=\"1.0\"?>" >> > + "<g:searchrequest xmlns:g=\"DAV:\">" >> > + "<g:sql>SELECT \"urn:schemas:calendar:location >> > \", \"urn:schemas:httpmail:subject\", " >> > + "\"urn:schemas:calendar:dtstart\", >> > \"urn:schemas:calendar:dtend\", " >> > + "\"urn:schemas:calendar:priority\", >> > \"urn:schemas:calendar:instancetype\" " >> > + "FROM Scope('SHALLOW TRAVERSAL OF \"" + uri + >> > "\"') " >> > + "WHERE NOT \"urn:schemas:calendar:instancetype >> > \" = 1 " >> > + "AND \"DAV:contentclass\" = 'urn:content- >> > classes:appointment' " >> > + "AND \"urn:schemas:calendar:dtstart\" > >> > '2003/06/01 00:00:00' " >> > + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC" >> > + "</g:sql></g:searchrequest>"; >> >> > Works fine. Any ideas how to get the label (colouring) of the >> > appointment? >> >> > and what should the "TODO" field be for the colouring? >> >> > XmlNodeList locationNodes = document.GetElementsByTagName("TODO"); >> >> > Thanks a lot for the help, >> >> > B > > Hi,
I've checked the response before sending it to the xml parser. The items which are returned look like: <a:response> <a:href>https://blabla/Calendar/{blablabla}.EML</a:href> <a:propstat> <a:status>HTTP/1.1 200 OK</a:status> <a:prop> <d:location></d:location> <e:subject>item1</e:subject> <d:dtstart b:dt="dateTime.tz">2006-01-18T23:00:00.000Z</d:dtstart> <d:dtend b:dt="dateTime.tz">2006-01-19T23:00:00.000Z</d:dtend> <d:instancetype b:dt="int">0</d:instancetype> </a:prop> </a:propstat> <a:propstat> <a:status>HTTP/1.1 404 Resource Not Found</a:status> <a:prop> <d:priority/><f:0x8214/> </a:prop> </a:propstat> </a:response> So, the problem occurs before parsing the XML stream. Is the query which I've used (see previous messages) really ok? Regards, Bart Hello,
you have this in the response: <a:prop> <d:priority/><f:0x8214/> </a:prop> And the tag <f:0x8214 /> is not valid xml because its local name starts with a digit. If you replace ":0x" with something like ":null__x", you will be able to parse the xml using a XmlDocument or (better) XmlReader. Best regards, Henning Krause Show quote "bart" <bjan***@etro.vub.ac.be> wrote in message news:1178306502.739271.25190@u30g2000hsc.googlegroups.com... > Hi, > > I've checked the response before sending it to the xml parser. > > The items which are returned look like: > > <a:response> > <a:href>https://blabla/Calendar/{blablabla}.EML</a:href> > > <a:propstat> > <a:status>HTTP/1.1 200 OK</a:status> > <a:prop> > <d:location></d:location> > <e:subject>item1</e:subject> > <d:dtstart b:dt="dateTime.tz">2006-01-18T23:00:00.000Z</d:dtstart> > <d:dtend b:dt="dateTime.tz">2006-01-19T23:00:00.000Z</d:dtend> > <d:instancetype b:dt="int">0</d:instancetype> > </a:prop> > </a:propstat> > > <a:propstat> > <a:status>HTTP/1.1 404 Resource Not Found</a:status> > <a:prop> > <d:priority/><f:0x8214/> > </a:prop> > </a:propstat> > </a:response> > > So, the problem occurs before parsing the XML stream. Is the query > which I've used (see previous messages) really ok? > > Regards, > > Bart > |
|||||||||||||||||||||||