none
'Delegates only' site wide reporting RRS feed

  • Question

  • Hello -  I'm trying to figure out a way to report on mailboxes that have delegates added with the 'My Delegates only' option selected for meeting requests. Via powershell and the available cmdlets I can report on delegates and a boatload of other information but I haven't been able to sus out the info that would indicate the 'delegates only' option was set for meeting requests for that delegate.

    From what I gathered when you select the delegates only option a hidden rule is created on the primary mailbox that deletes the meeting requests, unfortunately that can only be accessed via MFCMapi on a one off basis and won't work for several thousand users.

    Is there a way to determine if the delegates only option was set for a delegate from the backend (or registry client side) for several thousand users?

    Thank you,
    Tony
    Thursday, February 6, 2014 10:12 PM

All replies

  • You would need to access the Mailbox itself to get this information so would require that you use a Mailbox API either MAPI or EWS depending on what version of Exchange your using ?.

    EG to do this with the EWS Managed API in 2007,2010,13 as long as you have full access to the Mailbox your targeting. The information your after is returned as the MeetingRequestsDeliveryScope

    ## Get the Mailbox to Access from the 1st commandline argument
    
    $MailboxName = $args[0]
    
    ## Load Managed API dll  
    Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"  
      
    ## Set Exchange Version  
    $ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2  
      
    ## Create Exchange Service Object  
    $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($ExchangeVersion)  
      
    ## Set Credentials to use two options are availible Option1 to use explict credentials or Option 2 use the Default (logged On) credentials  
      
    #Credentials Option 1 using UPN for the windows Account  
    $psCred = Get-Credential  
    $creds = New-Object System.Net.NetworkCredential($psCred.UserName.ToString(),$psCred.GetNetworkCredential().password.ToString())  
    $service.Credentials = $creds      
      
    #Credentials Option 2  
    #service.UseDefaultCredentials = $true  
      
    ## Choose to ignore any SSL Warning issues caused by Self Signed Certificates  
      
    ## Code From http://poshcode.org/624
    ## Create a compilation environment
    $Provider=New-Object Microsoft.CSharp.CSharpCodeProvider
    $Compiler=$Provider.CreateCompiler()
    $Params=New-Object System.CodeDom.Compiler.CompilerParameters
    $Params.GenerateExecutable=$False
    $Params.GenerateInMemory=$True
    $Params.IncludeDebugInformation=$False
    $Params.ReferencedAssemblies.Add("System.DLL") | Out-Null
    
    $TASource=@'
      namespace Local.ToolkitExtensions.Net.CertificatePolicy{
        public class TrustAll : System.Net.ICertificatePolicy {
          public TrustAll() { 
          }
          public bool CheckValidationResult(System.Net.ServicePoint sp,
            System.Security.Cryptography.X509Certificates.X509Certificate cert, 
            System.Net.WebRequest req, int problem) {
            return true;
          }
        }
      }
    '@ 
    $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)
    $TAAssembly=$TAResults.CompiledAssembly
    
    ## We now create an instance of the TrustAll and attach it to the ServicePointManager
    $TrustAll=$TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
    [System.Net.ServicePointManager]::CertificatePolicy=$TrustAll
    
    ## end code from http://poshcode.org/624
      
    ## Set the URL of the CAS (Client Access Server) to use two options are availbe to use Autodiscover to find the CAS URL or Hardcode the CAS to use  
      
    #CAS URL Option 1 Autodiscover  
    $service.AutodiscoverUrl($MailboxName,{$true})  
    "Using CAS Server : " + $Service.url   
       
    #CAS URL Option 2 Hardcoded  
      
    #$uri=[system.URI] "https://casservername/ews/exchange.asmx"  
    #$service.Url = $uri    
      
    ## Optional section for Exchange Impersonation  
      
    #$service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress, $MailboxName) 
    
    #Get Delegates for Mailbox  
    $delegates = $service.getdelegates($MailboxName,$true)  
    Write-Host ("Delivery Scope " +  $delegates.MeetingRequestsDeliveryScope)
    #Enumerate Delegates  
    foreach($Delegate in $delegates.DelegateUserResponses){  
    	Write-host ($Delegate.DelegateUser.UserId.PrimarySmtpAddress)
    	Write-Host ($Delegate.DelegateUser.ReceiveCopiesOfMeetingMessages)
    }  
    
    

    Cheers
    Glen

    Monday, February 10, 2014 5:53 AM