We need to move mailboxes over to a new Exchange server and want to dispense
with using WebDAV in lieu of EWS.
I have an old application that uses WebDAV, so I need to convert it to use
EWS.
I have a function that queries the Calendar folder using WebDAV and
"urn:schemas:mailheader:message-id". This ID is stored in a backend database
and is the key to finding the calendar item.
The problem is I cannot find the EWS equivalent.
Anybody have any ideas?
Thanks in advance,
Mike
strQuery = "<?xml version=""1.0""?>" & _
"<g:searchrequest xmlns:g=""DAV:"">" & _
"<g:sql>SELECT ""DAV:href"",
""urn:schemas:httpmail:subject"" " & _
", ""urn:schemas:httpmail:textdescription"" " & _
"FROM Scope('SHALLOW TRAVERSAL OF """ & strCalendarURI &
"""') " & _
"WHERE NOT ""urn:schemas:calendar:instancetype"" = 1 " & _
"AND ""DAV:contentclass"" =
'urn:content-classes:appointment' " & _
"AND ""urn:schemas:mailheader:message-id"" LIKE '" & sMID &
"%' " & _
" ORDER BY
""urn:schemas:mailheader:message-id""</g:sql></g:searchrequest>"
"milop" <mi...@slomins.com> wrote in message
news:e2X974ap...@TK2MSFTNGP05.phx.gbl...
ExchangeService service = new
ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new NetworkCredential("user",
"password","domain");
service.Url = new Uri("https://servername/ews/exchange.asmx");
ItemView ivew = new ItemView(3);
SearchFilter sf = new
SearchFilter.IsEqualTo(EmailMessageSchema.InternetMessageId, MessageID);
FindItemsResults<Item> iCol =
service.FindItems(WellKnownFolderName.Calendar, sf, ivew);
foreach (Item item in iCol.Items) {
Console.WriteLine(item.Subject);
}
But this isn't generally how you would query for calendar appointments as
both your webDAV and this EWS query isn't expanding recurring appointments.
It just going to allow you to find the raw objects. Im not sure why you
would use a Like if you know the messsageID then just do direct match.
Cheers
Glen
"milop" <mi...@slomins.com> wrote in message
news:elZDNIbp...@TK2MSFTNGP02.phx.gbl...
Good point about the "LIKE". I don't know why I did that (years ago).
I'm not concerned about recurrence. These appointments are not recurring.
Let me ask you something else: My backend app generates a unique 26-byte
character string (it's a timestamp down to the millisecond), creates the
calendar item, sets the message-id to the 26-byte string, saves the calendar
item, and stores the 26-byte key in a database. So message-id is used at a
later date to get to the calendar item in order to, say, update the body. In
EWS is there a better alternative to using message-id as a key?
Thanks again,
Mike
"Glen Scales [MVP]" <gsc...@outlookexchange.com> wrote in message
news:ubZzfDfp...@TK2MSFTNGP05.phx.gbl...
Cheers
Glen
"milop" <mi...@slomins.com> wrote in message
news:%23UrLsNl...@TK2MSFTNGP04.phx.gbl...
I was using your code and can't find ItemView.
The component I'm developing references the Exchange web service (as a web
reference), and I don't see ItemView in the class library.
Any ideas?
Thanks,
Mike
"Glen Scales [MVP]" <gsc...@outlookexchange.com> wrote in message
news:O%234S2RQq...@TK2MSFTNGP02.phx.gbl...
Ugh, this is killing me.
"milop" <mi...@slomins.com> wrote in message
news:ecsB051...@TK2MSFTNGP04.phx.gbl...