Giter VIP home page Giter VIP logo

Comments (4)

grahamr975 avatar grahamr975 commented on May 26, 2024

The script needs the ability to automatically delete contacts. We need this ability for two reasons:

  1. If a user is removed from your directory, remove the user's contact
  2. 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.

teconmoon avatar teconmoon commented on May 26, 2024

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.

grahamr975 avatar grahamr975 commented on May 26, 2024

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:

  1. If a user is removed from your directory, remove the user's contact
  2. If a user in your directory changes their email address, remove the user's old contact to prevent duplicates

from ews-office365-contact-sync.

x-zempt avatar x-zempt commented on May 26, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.