From c4068245bc27c13aa8a919046471a9cb480595f0 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Wed, 18 Sep 2024 13:24:30 +0200 Subject: [PATCH] improve examples --- Examples/01.PersonalContactsClear.ps1 | 12 +++++++++--- Examples/02.PersonalContactsSynchronize.ps1 | 12 +++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Examples/01.PersonalContactsClear.ps1 b/Examples/01.PersonalContactsClear.ps1 index 7290a07..6cd9b06 100644 --- a/Examples/01.PersonalContactsClear.ps1 +++ b/Examples/01.PersonalContactsClear.ps1 @@ -8,11 +8,17 @@ Connect-MgGraph -ClientSecretCredential $Credentials -TenantId $TenantID -NoWelc # this is useful to clear current user contacts (if you have some) # this will only delete synchronized ones (based on FileAs property that has to convert to GUID) -Clear-O365PersonalContact -Identity 'slawa@evotec.pl' -WhatIf +Clear-O365PersonalContact -Identity 'testAccount@evotec.pl' -WhatIf # this is useful to clear current user contacts (if you have some) # this will only delete synchronized ones (based on FileAs property that has to convert to GUID, with GUID prefix) -Clear-O365PersonalContact -Identity 'przemyslaw@evotec.pl' -GuidPrefix 'O365Synchronizer' -WhatIf +Clear-O365PersonalContact -Identity 'testAccount@evotec.pl' -GuidPrefix 'O365Synchronizer' -WhatIf # this will delete all contacts -Clear-O365PersonalContact -Identity 'slawa@evotec.pl' -All -WhatIf \ No newline at end of file +Clear-O365PersonalContact -Identity 'testAccount@evotec.pl' -All -WhatIf + +# this will only delete synchronized ones (based on FileAs property that has to convert to GUID, with GUID prefix) from specific folder +Clear-O365PersonalContact -Identity 'testAccount@evotec.pl' -GuidPrefix 'O365Synchronizer' -FolderName 'O365' -WhatIf + +# this will only delete synchronized ones (based on FileAs property that has to convert to GUID, with GUID prefix) from specific folder, including the folder +Clear-O365PersonalContact -Identity 'testAccount@evotec.pl' -GuidPrefix 'O365Synchronizer' -FolderName 'O365Sync' -FolderRemove -WhatIf \ No newline at end of file diff --git a/Examples/02.PersonalContactsSynchronize.ps1 b/Examples/02.PersonalContactsSynchronize.ps1 index 0597e94..83585a6 100644 --- a/Examples/02.PersonalContactsSynchronize.ps1 +++ b/Examples/02.PersonalContactsSynchronize.ps1 @@ -9,4 +9,14 @@ $Credentials = [pscredential]::new($ClientID, (ConvertTo-SecureString $ClientSec Connect-MgGraph -ClientSecretCredential $Credentials -TenantId $TenantID -NoWelcome # synchronize contacts for two users of two types (Member, Contact) using GUID prefix -Sync-O365PersonalContact -UserId 'test@evotec.pl', 'test1@evotec.pl' -Verbose -MemberTypes 'Member', 'Contact' -GuidPrefix 'O365Synchronizer' -WhatIf | Format-Table * \ No newline at end of file +Sync-O365PersonalContact -UserId 'test@evotec.pl', 'test1@evotec.pl' -Verbose -MemberTypes 'Member', 'Contact' -GuidPrefix 'O365Synchronizer' -WhatIf | Format-Table * + +# synchronize contacts for 1 user of two types (Member, Contact) using GUID prefix and filtering by company name +# this will only synchronize contacts that have CompanyName starting with 'Evotec' or 'Ziomek' +# this will also require contacts to be in a group by 'e7772951-4b0e-4f10-8f38-eae9b8f55962' +# this will also create a folder 'O365Sync' in user's personal contacts and put synchronized contacts there +# this will also return the results in a table +Sync-O365PersonalContact -UserId 'test@evotec.pl' -MemberTypes 'Contact', 'Member' -GuidPrefix 'O365Synchronizer' -PassThru { + Sync-O365PersonalContactFilter -Type Include -Property 'CompanyName' -Value 'Evotec*','Ziomek*' -Operator 'like' + Sync-O365PersonalContactFilterGroup -Type Include -GroupID 'e7772951-4b0e-4f10-8f38-eae9b8f55962' +} -FolderName 'O365Sync' | Format-Table \ No newline at end of file