none
Cannot create 'DistributionList' recipient using EWS Managed API RRS feed

  • Question

  • I need to copy data from MAPI IMessage interface to online Exchnage mailbox using EWS Managed API. And I'm stuck with recipients. I cannot create MAPI_DISTLIST recipient (PidTagObjectType equals 8). Here is how I'm creating a recipient (just an example):

    var newMessage = new EmailMessage(service);
    newMessage.ItemClass = "IPM.Note";
    var emailAddress = new EmailAddress(name, email, addressType);
    emailAddress.MailboxType = MailboxType.PublicGroup;
    newMessage.ToRecipients.Add(emailAddress);
    newMessage.Save(targetFolder.Id);

    I'm trying different MailboxType (PublicGroup, ContactGroup, etc.) But seems setting MailboxType has no effect. New recipient is always MAPI_MAILUSER (PidTagObjectType equals 6).

    <Trace Tag="EwsRequest" Tid="1" Time="2016-10-12 11:17:16Z" Version="0.0.0.0">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope ...>
        <soap:Header>
          ...
        </soap:Header>
        <soap:Body>
          <m:CreateItem MessageDisposition="SaveOnly">
            <m:SavedItemFolderId>
              <t:FolderId Id="id..." ChangeKey="key..." />
            </m:SavedItemFolderId>
            <m:Items>
              <t:Message>
                <t:ItemClass>IPM.Note</t:ItemClass>
                <t:ExtendedProperty>
                  ...
                </t:ExtendedProperty>
    
                <t:ToRecipients>
                  <t:Mailbox>
                    <t:Name>iTransition: TradingPartners Team</t:Name>
                    <t:EmailAddress>/O=BELHARD/OU=MINSK/CN=RECIPIENTS/cn=iTransition.TradingPartners.Team</t:EmailAddress>
                    <t:RoutingType>EX</t:RoutingType>
                    <t:MailboxType>PublicDL</t:MailboxType>
                  </t:Mailbox>
                </t:ToRecipients>
              </t:Message>
            </m:Items>
          </m:CreateItem>
        </soap:Body>
      </soap:Envelope>
    </Trace>


    Here is EWS request:I've checked the PR_OBJECT_TYPE property of the created recipient using MFCMAPI. And it was equal (MAPI_MAILUSER) But should be equal 8 (MAPI_DISTLIST).


    • Edited by borzykot Thursday, October 13, 2016 8:10 AM
    Wednesday, October 12, 2016 3:35 PM