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
94 stars 21 forks source link

FolderName = Subfolder of default contacts #83

Open fuegnera opened 1 year ago

fuegnera commented 1 year ago

Hi,

is there a possibility to sync the contects in a subfolder of the default contacts? f.e. contacts/internal

I tried \Contacts\internal, Contacts\internal, Contacts/internal.. everytime I get a folder in the root: 'contacts\internal'

thank you Achim

JihadSaleh commented 1 year ago

I would like to also know this, it would help as we are already using a subfolder for contacts ofmobile users and it would be nice if we can get that updated instead of the root path.

JihadSaleh commented 1 year ago

I found that if you want your root folder to be under the contacts folder.

You need to modify two scripts:-

In EWS-Office365-Contact-Sync\EWSContacts\Module\functions\folder\New-EXCContactFolder.ps1 File Changes these two lines:-

$ContactsFolder.Save([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot) $RootFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot)

To these two lines:- $ContactsFolder.Save([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Contacts) $RootFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Contacts)

In EWS-Office365-Contact-Sync\EWSContacts\Module\functions\folder\Get-EXCContactFolder.ps1 File From this:- $folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot, $MailboxName)

To This:- $folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Contacts, $MailboxName)