Forum Discussion

soumenbose's avatar
soumenbose
Copper Contributor
May 24, 2022

Get users personal contacts with Powershell for office365/Exchange

Hi All,

I am trying to retrieve user's personal contact on outlook web .

I have tried with following cmdlets but non of them giving the list of contacts.

 

Get-Contact

Get-Addresslist

Get-MailContact

Get-MailboxFolder

 

any help would be highly appreciated.

 

Thanks, 

  • soumenbose Unfortunately, there is no easy way to achieve this, traditional exchange powershell module wont expose specific contacts to you, i havent looked into it but you can take a look at the graph api module here: https://docs.microsoft.com/en-us/graph/api/contact-get?view=graph-rest-1.0&tabs=http 

    Going by the example you gave, you can create a Personal Contact list for each mailbox, you should be able to select all contacts and add them to the personal list in one go, now you can create an outlook rule for the specific list; personal contact lists arent supported as such in outlook rules but outlook will expand it to include all the members for the rule, but again this would require constant updating; so would the graph api one. Sorry, out of ideas here!

  • harveer singh's avatar
    harveer singh
    Steel Contributor

    Hey soumenbose 

     

    You wont be able to export or get info on a user's personal contacts using a powershell command in office 365, your best bet is using Ediscovery to export out a PST.

     

    Thanks

    • soumenbose's avatar
      soumenbose
      Copper Contributor
      Thanks harveer singh.
      here, I don't want to export, I just need to user poweshell command for create InboxRule using their personal contact and it will run on Exchange Server .
      Example : all user's personal contact's mails will be moved to "Personal Folder" , I can create inbox rule on outlook web but few user's have more than 1000 contact.
      • harveer singh's avatar
        harveer singh
        Steel Contributor

        soumenbose Unfortunately, there is no easy way to achieve this, traditional exchange powershell module wont expose specific contacts to you, i havent looked into it but you can take a look at the graph api module here: https://docs.microsoft.com/en-us/graph/api/contact-get?view=graph-rest-1.0&tabs=http 

        Going by the example you gave, you can create a Personal Contact list for each mailbox, you should be able to select all contacts and add them to the personal list in one go, now you can create an outlook rule for the specific list; personal contact lists arent supported as such in outlook rules but outlook will expand it to include all the members for the rule, but again this would require constant updating; so would the graph api one. Sorry, out of ideas here!

Resources