none
EWS "account that does not have a mailbox" error on IIS RRS feed

  • Question

  • I'm developing an intranet site that allow employees to see their corporate e-mail boxes. All users are in domain and their informations are on Active Directory. I implement windows authentication so I don't save credentials of users. I used EWS managed API and everything works perfect on IISExpress, however when I  publish site to IIS(also on my computer) i gave this error : "When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids".  Service takes default credentials and it works on IISExpress but not on IIS, if I write credentials manually system works on both IISExpress and IIS. I don't want to impersonate or delegate, there has to be way to direct access ? Is there a setting on IIS that should turn on which automatically set on IISExpress?

    CODE:

     ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
        service.UseDefaultCredentials = true; 
        service.AutodiscoverUrl("user@xx.com");
        SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
        ItemView view = new ItemView(100);
    
        FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sf, view);

    Trace:

     <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ResponseMessages>
              <m:FindItemResponseMessage ResponseClass="Error">
                <m:MessageText>When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.</m:MessageText>
                <m:ResponseCode>ErrorMissingEmailAddress</m:ResponseCode>
                <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
              </m:FindItemResponseMessage>
            </m:ResponseMessages>
          </m:FindItemResponse>
        </s:Body>

    What can be the problem? 

    Thanks for your help. 


    • Edited by Cembora Wednesday, October 5, 2016 12:21 PM
    Friday, September 23, 2016 7:36 AM

All replies

  • Did you find a way to make this work? I am having the same problem and so far have not been able to figure it out.
    Wednesday, December 7, 2016 5:33 PM