grahamr975 / EWS-Office365-Contact-Sync

Uses Exchange Web Services to synchronize a Global Address List in Office 365 to a user's mailbox
MIT License
96 stars 21 forks source link

Sync with AD Group #43

Closed Chudinnio closed 3 years ago

Chudinnio commented 3 years ago

Hello everyone,

I would like to deploy script on AD Group. So i changed Mailbox Parameter code:

[Parameter(Mandatory=$False)] [String[]] $MailboxList = @(Get-ADGroupMember -Identity ExampleName -recursive | get-aduser -Properties mail | select mail),

in powersahell when i check only: Get-ADGroupMember -Identity ExampleName -recursive | get-aduser -Properties mail | select mail, i got list of users but when i use it in parameter i got mail adres in format: @{mail=name.surname@domain.com} after that i got error that email adres is in bad format. What should i do? Any sugesstions?

grahamr975 commented 3 years ago

@Chudinnio

You need to add .mail to the end of your query to return the email itself. Right now, you're returning an object with the mail as a property. Try the line below instead and let me know.

MailboxList = @(Get-ADGroupMember -Identity ExampleName -recursive | get-aduser -Properties mail | select mail).mail

Chudinnio commented 3 years ago

@grahamr975 Thank you very much for help. It works!!!

rypto commented 1 year ago

@grahamr975 Thank you very much for help. It works!!!

Where exactly do you put this line? In which file and which line get replaced? Thanks