locked
[EWS] How to convert a Single appointment into a recurring series? RRS feed

  • Question

  • Hi, folks,
    My first post here. I bought the EWS book and searched insanely, but haven't found
    the answer.

    My idea is to resort to AppendToItemFieldType --- turn a single appointment
    into a recurring series by appending a calendarRecurrence property. It sounds
    the way to go, but I can't make it work. Am I on the right track?

    Here is my code.
    Code Snippet






    public static ItemIdType AppendRecurrence(ExchangeServiceBinding binding, ItemIdType aSingleItemId, RecurrenceType aRecurruence)
    {
    CalendarItemType calitem1 = new CalendarItemType();
    calitem1.Recurrence = aRecurrence;

    AppendToItemFieldType appendItem = new AppendToItemFieldType();
    appendItem.Item = new PathToUnindexedFieldType(
          UnindexedFieldURIType.calendarRecurrence);

    appendItem.Item1 = calitem1;

    UpdateItemType request = new UpdateItemType();
    request.ConflictResolution = ConflictResolutionType.AutoResolve;
    request.SendMeetingInvitationsOrCancellations =
            CalendarItemUpdateOperationType.SendToNone;
    request.SendMeetingInvitationsOrCancellationsSpecified = true;

    ItemChangeType itemChange = new ItemChangeType();
    itemChange.Item = aSingleItemId;
    itemChange.Updates = new ItemChangeDescriptionType[] {appendItem};

    request.ItemChanges = new ItemChangeType[] {itemChange};

    UpdateItemResponseType response = binding.UpdateItem(request);

    ItemInfoResponseMessageType responseMsg = response.ResponseMessages.Items[0]
          as ItemInfoResponseMessageType;
    if (responseMsg.ResponseCode != ResponseCodeType.NoError)
    {
    throw new Exception("UpdateItem failed with response code " +
          responseMsg.ResponseCode.ToString());
    }
    return responseMsg.Items.Items[0].ItemId;
    }



    Here is the error message I got

    ErrorInvalidPropertyAppend
    The append action is not supported for this property
    Wednesday, July 23, 2008 3:10 PM

Answers

  • Hi,

     

    You must use SetItemFieldType, not AppendToItemFieldType.

     

    Wednesday, July 23, 2008 3:51 PM
  • See page 366 of the EWS book - that is effectively what is being done in the example there.  The fact that it is a recurring meeting to begin with is somewhat moot.

    Wednesday, July 23, 2008 4:00 PM

All replies

  • Hi,

     

    You must use SetItemFieldType, not AppendToItemFieldType.

     

    Wednesday, July 23, 2008 3:51 PM
  • See page 366 of the EWS book - that is effectively what is being done in the example there.  The fact that it is a recurring meeting to begin with is somewhat moot.

    Wednesday, July 23, 2008 4:00 PM
  • Hi, David,

    Thanks for quick response. Following your advice, it's working now.


    Wednesday, July 23, 2008 4:07 PM