none
[ExchangeOnLine]What should I do to get the Global Address List RRS feed

  • Question

  • Hi everyone

    I want to get the GAL on the Exchange Online Service of Office365.

    Because of OnLine Service, I don't know how to connect to the Exchange Online AD.

    Anyone can help me to Get the GAL on the Office365.Thanks.

    Tuesday, July 19, 2011 10:47 AM

Answers

  • There are a few ways you could do it the first would be to create an OutlookAnywhere profile and just use Mapi, Exchange Web Services doesn't currently have any operations that allow you to do this type of directory functions. Probably the best method to use at the moment is use Remote Powershell eg you can use the Get-Recipient cmdlet to get the details of all the mailboxes, mailenabled contacts , Distribution lists ect eg

    String AdminUserName = "admin@yourdomain.com";
          String Password = "passwprd23";
    
          System.Security.SecureString secureString = new System.Security.SecureString();
          foreach (char c in Password)
            secureString.AppendChar(c);
          PSCredential credential = new PSCredential(AdminUserName, secureString);
          WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://ps.outlook.com/PowerShell-LiveID?PSVersion=2.0"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
          connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
          connectionInfo.SkipCACheck = true;
          connectionInfo.SkipCNCheck = true;
    
          connectionInfo.MaximumConnectionRedirectionCount = 4;
          Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
          runspace.Open();
          // Make a Get-Recipients Request
          Command grGetRecipient = new Command("Get-Recipient");
          grGetRecipient.Parameters.Add("ResultSize", "Unlimited");
          Pipeline plPileLine = runspace.CreatePipeline();
          plPileLine.Commands.Add(grGetRecipient);
          Collection<PSObject> RsResultsresults = plPileLine.Invoke();
          foreach (PSObject obj in RsResultsresults)
          {
            Console.WriteLine(obj.Properties["RecipientType"].Value);
            Console.WriteLine(obj.Properties["DisplayName"].Value);
            Console.WriteLine(obj.Properties["PrimarySmtpAddress"].Value);
          }
          plPileLine.Stop();
          plPileLine.Dispose();
    

     There are also specific office365 administration cmdlet that allow you to get non Exchange users (eg user you that maybe only have access to other parts of the service etc). see http://onlinehelp.microsoft.com/en-us/office365-enterprises/hh124998.aspx.

    Cheers
    Glen

    • Marked as answer by jr2fc Wednesday, July 20, 2011 7:38 AM
    Wednesday, July 20, 2011 6:16 AM

All replies

  • There are a few ways you could do it the first would be to create an OutlookAnywhere profile and just use Mapi, Exchange Web Services doesn't currently have any operations that allow you to do this type of directory functions. Probably the best method to use at the moment is use Remote Powershell eg you can use the Get-Recipient cmdlet to get the details of all the mailboxes, mailenabled contacts , Distribution lists ect eg

    String AdminUserName = "admin@yourdomain.com";
          String Password = "passwprd23";
    
          System.Security.SecureString secureString = new System.Security.SecureString();
          foreach (char c in Password)
            secureString.AppendChar(c);
          PSCredential credential = new PSCredential(AdminUserName, secureString);
          WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://ps.outlook.com/PowerShell-LiveID?PSVersion=2.0"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
          connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
          connectionInfo.SkipCACheck = true;
          connectionInfo.SkipCNCheck = true;
    
          connectionInfo.MaximumConnectionRedirectionCount = 4;
          Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
          runspace.Open();
          // Make a Get-Recipients Request
          Command grGetRecipient = new Command("Get-Recipient");
          grGetRecipient.Parameters.Add("ResultSize", "Unlimited");
          Pipeline plPileLine = runspace.CreatePipeline();
          plPileLine.Commands.Add(grGetRecipient);
          Collection<PSObject> RsResultsresults = plPileLine.Invoke();
          foreach (PSObject obj in RsResultsresults)
          {
            Console.WriteLine(obj.Properties["RecipientType"].Value);
            Console.WriteLine(obj.Properties["DisplayName"].Value);
            Console.WriteLine(obj.Properties["PrimarySmtpAddress"].Value);
          }
          plPileLine.Stop();
          plPileLine.Dispose();
    

     There are also specific office365 administration cmdlet that allow you to get non Exchange users (eg user you that maybe only have access to other parts of the service etc). see http://onlinehelp.microsoft.com/en-us/office365-enterprises/hh124998.aspx.

    Cheers
    Glen

    • Marked as answer by jr2fc Wednesday, July 20, 2011 7:38 AM
    Wednesday, July 20, 2011 6:16 AM
  • Thanks Glen,

    It's very helpeful for me.

    Thank you very much.

    Wednesday, July 20, 2011 7:42 AM