Comments (4)
The script needs the ability to automatically delete contacts. We need this ability for two reasons:
- If a user is removed from your directory, remove the user's contact
- If a user in your directory changes their email address, remove the user's old contact to prevent duplicates
Disabling delete will remove the above features. I would not advise this. How are you creating these custom contacts? Can you add instead add your custom contacts as users in your GAL? Try to run the script with the -IncludeNonUserContacts flag.
from ews-office365-contact-sync.
By custom contacts I more meant random contacts created by the end users, usually for people outside our organization that they work with. Not contacts maintained by our IT Staff.
If a parameter to bypass deletion is out-of-scope for what this script is aiming to accomplish, I understand.
from ews-office365-contact-sync.
Ok, I understand. You want to make sure user-created contacts won't be deleted. Unfortunately, I won't be adding your requested parameter because it would break the script's syncing functionality. I've included the reasons why below. Sorry for the inconvenience.
The script needs the ability to automatically delete contacts. We need this ability for two reasons:
- If a user is removed from your directory, remove the user's contact
- If a user in your directory changes their email address, remove the user's old contact to prevent duplicates
from ews-office365-contact-sync.
@teconmoon
I stumbled across this issue you posted while searching to see if I could find a resolution for another issues I'm having.
I've adjusted the script to do just this for our company.
Basically, when it is checking for contacts to delete, I've added a rule to only delete ones that are not in the GAL and ALSO are of our domain only. So it will update and remove our business contacts from GAL. But won't touch the end users external contacts.
It has some hardcoded internal data at the moment, but I'll see if I can remove the hardcoded stuff and use variables and put a pull request in, or maybe a fork if needed.
Edit:
Actually, this is what I've done, we have two company domains that we use for email addresses. you can see where I've put domain1.com and domain2.com
Just replace those with your email domains.
$MailboxContactsToBeDeleted = $MailboxContacts | Where-Object {((($_.EmailAddresses[[Microsoft.Exchange.WebServices.Data.EmailAddressKey]::EmailAddress1].Address.ToLower() -like "*domain1.com*") -or ($_.EmailAddresses[[Microsoft.Exchange.WebServices.Data.EmailAddressKey]::EmailAddress1].Address.ToLower() -like "*domain2.com*")) -and (!$ContactList.WindowsEmailAddress.ToLower().Contains($_.EmailAddresses[[Microsoft.Exchange.WebServices.Data.EmailAddressKey]::EmailAddress1].Address.ToLower())))}
$MailboxContactsToBeDeleted.count
$MailboxContactsToBeUpdated = $ContactList | Where-Object {$MailboxEmailList.Contains($_.WindowsEmailAddress)}
$MailboxContactsToBeUpdated.count
$MailboxContactsToBeCreated = $ContactList | Where-Object {!$MailboxEmailList.Contains($_.WindowsEmailAddress)}
$MailboxContactsToBeCreated.count
Remove the below if you only have one domain for your emails, add additional if you have more.
-or ($_.EmailAddresses[[Microsoft.Exchange.WebServices.Data.EmailAddressKey]::EmailAddress1].Address.ToLower() -like "*domain2.com*")
from ews-office365-contact-sync.
Related Issues (20)
- Exclude Specific Users from receiving the GAL sync HOT 1
- Sync Pager HOT 3
- Failed to load the Certificate (then failed to fetch GAL contacts) HOT 1
- Error (403) HOT 1
- Microsoft deprecate Azure AD, Azure AD-Preview, and MS Online PowerShell modules on March 30, 2024 HOT 2
- Impossible to configure as a scheduled task from Windows
- GAL Update
- Better details in docs HOT 1
- Howto specify more than one mailbox to sync from command line ? HOT 5
- Issue adding Fax and Pager fields to the contacts HOT 1
- EWSContactSync.ps1 : Cannot convert the "System.Management HOT 2
- Failed verify that Directory Contacts exists HOT 2
- Could not load file or assembly 'System.Net.Http, Version=4.2.0.0 HOT 4
- Scripts Exceptions in Catch and Get-GALContacts HOT 2
- Sync contacts to the default folder name. HOT 1
- Apply the script only user mailboxes HOT 3
- Identifying errors in the log HOT 1
- Cannot find an appropriate constructor for type Microsoft.Exchange.WebServices.Data.OAuthCredentials HOT 5
- Duplicate Contacts in Folder HOT 1
- Running script in Azure Automation Account HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ews-office365-contact-sync.