Exchange Web Services Invalid Restriction

I am trying to understand why the following restriction is considered to be invalid:

<?xml version=\"1.0\" encoding=\"utf-16\"?>
<FindItemType xmlns:xsd=\"\" xmlns:xsi=\"\" Traversal=\"Shallow\">
  <ItemShape xmlns=\"\">
    <BaseShape xmlns=\"\">IdOnly</BaseShape>
  </ItemShape>\r\n  <CalendarView MaxEntriesReturned=\"5000\" StartDate=\"2009-04-14T09:39:16.4531250-04:00\" EndDate=\"2011-04-14T09:39:16.4531250-04:00\" xmlns=\"\" />
  <Restriction xmlns=\"\">
    <Or xmlns=\"\">
          <ExtendedFieldURI PropertySetId=\"a8350054-6f9e-4aaa-b6b7-4b0f12b2f80a\" PropertyName=\"AnKey1\" PropertyType=\"String\" />
        <ExtendedFieldURI PropertySetId=\"a8350054-6f9e-4aaa-b6b7-4b0f12b2f80a\" PropertyName=\"AnKey1\" PropertyType=\"String\" />
          <Constant Value=\"\" />\
  <ParentFolderIds xmlns=\"\">
    <DistinguishedFolderId Id=\"calendar\" xmlns=\"\" />

Open in new window

Who is Participating?
LeeDerbyshireConnect With a Mentor Commented:
Is the backslash really on the end of line 16?  Or did it creep in when you posted the question?
FHoldenAuthor Commented:
It crept in during the post sry
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Does your XML response say which part of the restriction it doesn't like?  If not, try removing each of the clauses in turn (you'll probably have to also remove the surrounding <Or/> when you do this) to find out which one is causing the problem.
FHoldenAuthor Commented:
Unfortunately it simply states "Invalid Restriction".  I have tried quiet a few variations, as soon as I put a restriction on I get "Invalid Restriction" back.  I was hoping that perhaps fresh eyes would see a namespace/conformance issue that I had missed.
FHoldenAuthor Commented:
Well that's terrible, my understanding is that you can only retreive expanded occurances using the calendar view (since I am doing calendar sync's they are needed).

I suppose I could use the calendarview across the time span and filter the items locally...but that seems an odd approach.

Thank you for your efforts Lee
Yes, I'd suggest inspecting each of the items in the expansion, looking for your specific properties.  Maybe the Managed API can do it, but I never use it, so I don't know.  There aren't many other developers here, and I think the best place to ask would be the Technet Exchange Development forum on the MS site.  Lots of clever people there.
FHoldenAuthor Commented:
It's not a big deal, I already have the code base to translate a where style query into a parse tree.  From there I generate sql,C#,Restrictions, or postfix ldap as's just a pain.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.