Using Web Service for OutOfOffice is resulting in Access Denied RRS feed

  • Question

  • We want to get out of office status of other users using Exchange web service. We want to query exchange web service to  
    read users out of office status and integrate this service with a sharepoint portal.                                                    
    I can get self user out of office status but couldn't get other users.  Result: "access denied" message.                                    
    I received the access denied error even with a user who is schema     
    admin, domain admin, Organisation admin.                                                                                                     
    I can successfully use Outlook web access to manage my organisation and
    see the status of Oof.

    Exchange Web service Address:           
    Exchange Version is : Exchange 2010 SP1 Rollup 8                        
    <Trace Tag="EwsResponseHttpHeaders" Tid="1" Time="2014-07-02 13:22:17Z">
    HTTP/1.1 200 OK                                                         
    Transfer-Encoding: chunked                                              
    Content-Encoding: gzip                                                  
    Vary: Accept-Encoding                                                   
    Persistent-Auth: true                                                   
    Cache-Control: private                                                  
    Content-Type: text/xml; charset=utf-8                                   
    Date: Wed, 02 Jul 2014 13:22:17 GMT                                     
    Server: Microsoft-IIS/7.5                                               
    X-AspNet-Version: 2.0.50727                                             
    X-Powered-By: ASP.NET                                                   
    <Trace Tag="EwsResponse" Tid="1" Time="2014-07-02 13:22:17Z" Version="  
    <?xml version="1.0" encoding="utf-8"?>                                  
    <s:Envelope xmlns:s="">        
    <h:ServerVersionInfo MajorVersion="14" MinorVersion="3"                 
    MajorBuildNumber="123" MinorBuildNumber="3" Version="Exchange2010_SP2"  
    xmlns="" xmlns:
    xsi="" xmlns:xsd="http://www." />                                               
    <s:Body xmlns:xsi="" xmlns:    
    <GetUserOofSettingsResponse xmlns="            
    <ResponseMessage ResponseClass="Error">                                 
    <MessageText>Access is denied. Check credentials and try again.         

    |Error|Application_ThreadException|Unhandled  exception!|                                                             
    Exception details:                                                      
    Message: Access is denied. Check credentials and try again.             
    Type: Microsoft.Exchange.WebServices.Data.ServiceResponseException      
    Source: Microsoft.Exchange.WebServices                                  
    ErrorCode: ErrorAccessDenied                                            
    ErrorMessage: Access is denied. Check credentials and try again.        
    Stack Trace:                                                            
    at Microsoft.Exchange.WebServices.Data.ServiceResponse.                 
    at Microsoft.Exchange.WebServices.Data.GetUserOofSettingsRequest.       
    at Microsoft.Exchange.WebServices.Data.ExchangeService.                 
    GetUserOofSettings(String smtpAddress)                                  
    at EWSEditor.Forms.OofForm.DisplayOofSettings() in c:                   
    .cs:line 369                                                            
    at EWSEditor.Forms.OofForm.GetOofButton_Click(Object sender, EventArgs  
    e) in c:                                                                
    .cs:line 166                                                            
    at System.Windows.Forms.Control.OnClick(EventArgs e)                    
    at System.Windows.Forms.Button.OnClick(EventArgs e)                     
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)         
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons      
    button, Int32 clicks)                                                   


    We also tried the Exchange impersonation, created a service account and gave it rights as follow;                                               
    New-ManagementRoleAssignment -Name <impersonationAssigmentName> -Role   
    applicationImpersonation -User <serviceAccount>                         
    But didn't help - still receive access denied when I want to query      other user oof with web service.                                        
    Also, changed the basic authentication type as you mentioned for EWS  application under IIS. But no change.                                    
    --> succesfully access my Out of office setting but not other users.  

    What is going wrong?

    thanks - Katrin


    Tuesday, July 8, 2014 11:48 AM

All replies

  • >>received the access denied error even with a user who is schema     
    admin, domain admin, Organisation admin.   

    To access another Mailboxes Out of Office status using that operation you would need FullAccess rights to the Target Mailbox (eg granted via Add-MailboxPermissions). Administration rights and Role membership doesn't make a different in this context. If you are an Exchange Admin you could use Remote Powershell and the  Get-MailboxAutoReplyConfiguration cmdlet.

    >>We also tried the Exchange impersonation, created a service account and gave it rights as follow;

    That should work okay but did you change your code to use impersonation ? what does your code look like ?

    A more efficient way of doing this on 2010 is to use the OOF MailTip this doesn't require any special permissions and you can get multiple status in one call there is a sample of this


    Wednesday, July 9, 2014 6:22 AM