none
Exchange distribution list details through office api RRS feed

  • Question

  • HI, 

    Is there any way to expand the exchange distribution list through office api. Right now it seems like there is nothing in office.context to get this detail where we can get detail of all the people in distribution list.

    makeewsrequestasync only does limited operation , so can't even get this information from.exchange.

    Does somebody have any idea about this?

    Monday, September 5, 2016 7:59 PM

Answers

  • Nitrup,

    This is unfortunate, but I have the same error "The requested web method is unavailable to this caller or application." when send request to expand a DL. Furthermore , there is the list of supported EWS operation in Outlook add-in and expandDL is not one of them. Other than that I am not sure how to expand DL inside add-in. Probably someone from moderators able to clarify, but it looks like it is not possible at the time.

    Best regards,


    Slava Ivanov

    Thursday, September 8, 2016 4:09 PM

All replies

  • Hi,

    Do you want to add new items in the exchange distribution list?

    The makeEwsRequestAsync method has limited function, used to sending an EWS request on behalf of the add-in to Exchange. We are unable to use it to expand the distribution list.

    I have checked in outlook API reference, there is no such API to expand the exchange distribution list in Office add-ins.

    Tuesday, September 6, 2016 9:12 AM
    Moderator
  • No, I  need to get the list of all individuals belong to a distribution list. 

    Can we use rest api to get this info??

    Tuesday, September 6, 2016 7:53 PM
  • Hi,

    Sorry, as far as I am concerned, outlook API doesn’t provide this method after checking.

    You could submit your requirement to the Office Developer Platform UserVoice page.

    Please visit https://officespdev.uservoice.com/

    Regards,

    Celeste

    Thursday, September 8, 2016 8:46 AM
    Moderator
  • Hello Nitrup,

    Office.js api does not provide functionality to expand distribution list. To get it working I would mix Office API functionality with EWS requests as follow ...

    - Get recipients list by using Office API from to, cc and bcc fields (Office.context.mailbox.item.to.getAsync(callback);). When you'll retrieve all the recipients objects go through and check every recipient type. If the type is "DistributionList" collect those recipients into temporary array. You code may look like this ...

    // do the same for cc and bcc
    Office.context.mailbox.item.to.getAsync(function(result) {
      if (result.error) {
        showMessage(result.error);
      } else {
        result.value.forEach(function(recip, index) {
          if (recip.recipientType === "DistributionList") {
          	// collect recipt object
          }
        });
      }
    });

    - Now go through your temporary array of distribution lists and create EWS request to expand distribution lists; you should be able to make one request for all distribution names at once. The request should looks like ...

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <soap:Body>
        <ExpandDL xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
                  xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
          <Mailbox>
            <t:EmailAddress>employees@contoso.com</t:EmailAddress>
          </Mailbox>
        </ExpandDL>
      </soap:Body>
    </soap:Envelope>

    As the response you will get expanded DLs; please note some of the members of the DL returned can be group on its own (will be indicated in "MailboxType" node). For those members you need to do separate request to expand them as well and so on ... recursive till you have only regular users. More information on how to use EWS over there: How to: Expand distribution groups by using EWS

    This is not trivial task to perform, but at the end you will solve your task.

    Hope this helps,

     


    Slava Ivanov

    Thursday, September 8, 2016 1:52 PM
  • HI Slava,

    Thanks for the update. i assume you are talking about using makeEWsRequestAsync call by using above xml. we already tried that. But makeEWsRequestAsync allows only limited operation and ExpandDL is not a listed operation. so we get an error saying this operation is not allowed.

    Did that work for you? I am not sure if i am doing anything wrong or we need to setup anything.

    Thanks

    Nit

    Thursday, September 8, 2016 3:05 PM
  • Nitrup,

    Unfortunately I didn't try myself to expend Dls with EWS. I just don't need to perform any recipient manipulation in our add-in, but you are intriguing me a lot with the error returned from EWS. I saw once this error when I tried to update master categories list, but this was an update request; just to get Master Categories List was fine. From my understanding expand DL doesn't perform any modification to group itself, so it's like get request. Anyways, I'll try to make the request and see how its go. Give me a day to write the code and I'll let you know my results.

    Best regards,


    Slava Ivanov

    Thursday, September 8, 2016 3:19 PM
  • Nitrup,

    This is unfortunate, but I have the same error "The requested web method is unavailable to this caller or application." when send request to expand a DL. Furthermore , there is the list of supported EWS operation in Outlook add-in and expandDL is not one of them. Other than that I am not sure how to expand DL inside add-in. Probably someone from moderators able to clarify, but it looks like it is not possible at the time.

    Best regards,


    Slava Ivanov

    Thursday, September 8, 2016 4:09 PM
  • This is now supported in Exchange 2016 CU9 and has been in Office 365 for a while now. It is not updated in the documentation yet, but I have used it and included it in my EWS Library: http://github.com/davecra/easyews. There is more detail on my blog at http://theofficecontext.com.
    Friday, April 27, 2018 6:28 PM