Getting isCancelled property for a Calendar Item using a FindItem(FindItemType) request fails RRS feed

  • Question

  • I'm having a problem returning all the properties I need for a calendar item, specifically the isCancelled property.

    I'm creating an ItemResponseShapeType object, and adding a PathToUnindexedFieldType object to the ItemResponseShapeType.AdditionalProperties BasePathToElementType array that has a FieldURI set to UnindexedFieldURIType.calendarIsCancelled.  (this is why I'm so confused I think - OO overload)

    When I make a ExchangeServiceBinding.FindItem(FindItemType t) method call after I set the above objects/properties, I get a response from the webservice that says, "Property is not valid for this operation.".

    I'm having trouble understanding the documentation of how I should be querying these calendar items.  Perhaps I'm on the entriely wrong track to begin with, but I'd appreciate any advice you could pass along.

    Here is the full code I'm trying to run:

                ExchangeServiceBinding esb = new ExchangeServiceBinding();
                //esp properties set here but removed for simplicity

                FindItemType findItemRequest = new FindItemType();

                CalendarViewType calendarView = new CalendarViewType();
                //calendarView properties set here but removed for simplicity

                findItemRequest.Item = calendarView;
                ItemResponseShapeType itemProperties = new ItemResponseShapeType();
                itemProperties.BaseShape = DefaultShapeNamesType.Default;
                //my attempt to specify that IsCancelled be returned in the results
                PathToUnindexedFieldType addIsCancelled = new PathToUnindexedFieldType();
                addIsCancelled.FieldURI = UnindexedFieldURIType.calendarIsCancelled;
                itemProperties.AdditionalProperties = new BasePathToElementType[] { addIsCancelled };

                findItemRequest.ItemShape = itemProperties;

                DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1];
                folderIDArray[0] = new DistinguishedFolderIdType();
                folderIDArray[0].Id = DistinguishedFolderIdNameType.calendar;

                if (!string.IsNullOrEmpty(roomEmail)) {
                    folderIDArray[0].Mailbox = new EmailAddressType();
                    folderIDArray[0].Mailbox.EmailAddress = roomEmail;

                findItemRequest.ParentFolderIds = folderIDArray;

                // Define the traversal type.
                findItemRequest.Traversal = ItemQueryTraversalType.Shallow;

                FindItemResponseType findItemResponse = esb.FindItem(findItemRequest);

                // Access the response message.
                ArrayOfResponseMessagesType responseMessages = findItemResponse.ResponseMessages;
                ResponseMessageType[] rmta = responseMessages.Items;

                foreach (ResponseMessageType rmt in rmta) {
                    // One FindItemResponseMessageType per folder searched.
                    FindItemResponseMessageType firmt = rmt as FindItemResponseMessageType;

                    //ERROR RETURNED HERE - "Property is not valid for this operation."


    Tuesday, April 20, 2010 1:58 PM


All replies