none
Get list of users in C# code, who has Mailbox Access permissions to Particular User RRS feed

  • Question

  • Hi,

    I am using Exchange Server 2013. In my server, Full Mailbox access permissions of some users has granted to one particular user [ ex: Exadmin@admin.com].

    Now i need the list who has access permissions to Exadmin@admin.com in C# code.

    In the below code i am getting all users list of my server using Administrator account.

     SecureString password = new SecureString();
                  string str_password = "xxxxx";
                  string username = "Administrator@admin.com";
                  foreach (char x in str_password) { password.AppendChar(x); }
                  PSCredential credential = new PSCredential(username, password);
    
                  WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://ExchangeServer.admin.com/powershell/Microsoft.Exchange"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
    
                  Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo);
    
                  PowerShell powershell = PowerShell.Create();
    
                  PSCommand command = new PSCommand();
                  command.AddCommand("Get-Mailbox");
                  command.AddParameter("ResultSize", int.MaxValue);
                  powershell.Commands = command;
                  runspace.Open();
                  powershell.Runspace = runspace;
                  Collection<PSObject> usersList = powershell.Invoke();
                  runspace.Close();

     Now i need to access list of users who has mailbox permissions access toExadmin@admin.com , instead of all users.

    Please share your ideas

    Tuesday, July 8, 2014 6:50 AM

Answers

All replies