OfficeDev / ews-managed-api

Other
584 stars 319 forks source link

Only the last ConversationId is submitted by EnableAlwaysCategorizeItemsInConversations() #163

Closed avereshchak closed 6 years ago

avereshchak commented 6 years ago

When multiple conversation identifiers are submitted using the ExchangeService.EnableAlwaysCategorizeItemsInConversations() an incorrect EWS request is built having only the last conversation identifier appearing as many times as the number of identifiers.

The following code demonstrates the problem:

var service = new ExchangeService();
// TODO: supply valid mailbox credentials

var ids = new ConversationId[]
{
    "AAQkADFhNDJkOTk2LTU3MTYtNDNjMy1hZjVhLTU3M2IxMTA2OGUyZQAQADQSVnjJLUABu0pzicj5nQU=",
    "AAQkADFhNDJkOTk2LTU3MTYtNDNjMy1hZjVhLTU3M2IxMTA2OGUyZQAQAEznFJVdE0xFgmrjNb8F+oo="
};
var categories = new[] {"My category"};
var response = service.EnableAlwaysCategorizeItemsInConversations(ids, categories, true);

An excerpt from EWS dump (note the last identifier is being repeated):

<Trace Tag="EwsRequest" Tid="1" Time="2018-03-07 15:10:59Z" Version="2.2.1.0">
  <?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
      <t:RequestServerVersion Version="Exchange2010_SP2" />
    </soap:Header>
    <soap:Body>
      <m:ApplyConversationAction>
        <m:ConversationActions>
          <t:ConversationAction>
            <t:Action>AlwaysCategorize</t:Action>
            <t:ConversationId Id="AAQkADFhNDJkOTk2LTU3MTYtNDNjMy1hZjVhLTU3M2IxMTA2OGUyZQAQAEznFJVdE0xFgmrjNb8F+oo=" />
            <t:ProcessRightAway>true</t:ProcessRightAway>
            <t:Categories>
              <t:String>My category</t:String>
            </t:Categories>
          </t:ConversationAction>
          <t:ConversationAction>
            <t:Action>AlwaysCategorize</t:Action>
            <t:ConversationId Id="AAQkADFhNDJkOTk2LTU3MTYtNDNjMy1hZjVhLTU3M2IxMTA2OGUyZQAQAEznFJVdE0xFgmrjNb8F+oo=" />
            <t:ProcessRightAway>true</t:ProcessRightAway>
            <t:Categories>
              <t:String>My category</t:String>
            </t:Categories>
          </t:ConversationAction>
        </m:ConversationActions>
      </m:ApplyConversationAction>
    </soap:Body>
  </soap:Envelope>
</Trace>
avereshchak commented 6 years ago

I've just provided the https://github.com/OfficeDev/ews-managed-api/pull/164 to address the problem.