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).

    Here is EWS request:

    <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>

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






    • Edited by borzykot Wednesday, October 12, 2016 3:23 PM
    Wednesday, October 12, 2016 3:16 PM