none
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: https://webmail.abcdegf.com.           
    tr/ews/exchange.asmx                                                    
    Exchange Version is : Exchange 2010 SP1 Rollup 8                        
                                                                            
    2014-07-02T16:22:17|EwsTrace|DisplayOofSettings|EwsResponseHttpHeaders| 
    <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>                                                                
                                                                            
    2014-07-02T16:22:17|EwsTrace|DisplayOofSettings|EwsResponse|            
    <Trace Tag="EwsResponse" Tid="1" Time="2014-07-02 13:22:17Z" Version="  
    15.00.0847.030">                                                        
    <?xml version="1.0" encoding="utf-8"?>                                  
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">        
    <s:Header>                                                              
    <h:ServerVersionInfo MajorVersion="14" MinorVersion="3"                 
    MajorBuildNumber="123" MinorBuildNumber="3" Version="Exchange2010_SP2"  
    xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"     
    xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:
    xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.  
    w3.org/2001/XMLSchema" />                                               
    </s:Header>                                                             
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:    
    xsd="http://www.w3.org/2001/XMLSchema">                                 
    <GetUserOofSettingsResponse xmlns="http://schemas.microsoft.            
    com/exchange/services/2006/messages">                                   
    <ResponseMessage ResponseClass="Error">                                 
    <MessageText>Access is denied. Check credentials and try again.         
    </MessageText>                                                          
    <ResponseCode>ErrorAccessDenied</ResponseCode>                          
    <DescriptiveLinkKey>0</DescriptiveLinkKey>                              
    </ResponseMessage>                                                      
    </GetUserOofSettingsResponse>                                           
    </s:Body>                                                               
    </s:Envelope>                                                           
    </Trace>                                                                 

    |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.                 
    InternalThrowIfNecessary()                                              
    at Microsoft.Exchange.WebServices.Data.GetUserOofSettingsRequest.       
    Execute()                                                               
    at Microsoft.Exchange.WebServices.Data.ExchangeService.                 
    GetUserOofSettings(String smtpAddress)                                  
    at EWSEditor.Forms.OofForm.DisplayOofSettings() in c:                   
    \Users\danba\Source\Workspaces\ewseditor\EWSEditor\Forms\Dialogs\OofForm
    .cs:line 369                                                            
    at EWSEditor.Forms.OofForm.GetOofButton_Click(Object sender, EventArgs  
    e) in c:                                                                
    \Users\danba\Source\Workspaces\ewseditor\EWSEditor\Forms\Dialogs\OofForm
    .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


    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 http://blogs.msdn.com/b/devmsg/archive/2014/06/03/ews-how-to-retrieve-the-oof-out-of-facility-settings-message-using-ews-for-an-exchange-user.aspx

    Cheers
    Glen

    Wednesday, July 9, 2014 6:22 AM