Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter adding single user creates odd issue #21

Open
PDMAdmin opened this issue Jan 9, 2025 · 6 comments
Open

Filter adding single user creates odd issue #21

PDMAdmin opened this issue Jan 9, 2025 · 6 comments

Comments

@PDMAdmin
Copy link

PDMAdmin commented Jan 9, 2025

I have code written to sync a single user to all users with an email address from our organization. Code below.

Sync-O365PersonalContact -UserId $Users.EmailAddress -MemberTypes 'Member', 'Contact' -GuidPrefix 'O365Synchronizer' -PassThru {Sync-O365PersonalContactFilter -Type Include -Property 'Mail' -Value $Contact -Operator 'equal'} | Format-Table *

When I run this code with a user, it will add the filtered user to all users in the company. When I run it a second time with a different filtered user, it add the second filtered user, but simultaneously removes the previously added user. What IF code below, names and email addresses removed.

[i] User ContactUser has 124 contacts, out of which 1 synchronized.
[i] Users to process: 1 Contacts to process: 1
[i] Processing User2name / User2email
[+] Creating User2name / User2email
What if: Performing the operation "New-MgUserContact_CreateExpanded" on target "Call remote 'POST /users/{user-id}/contacts' operation".
[x] Removing (not required) User1name
What if: Performing the operation "Remove-MgUserContact_Delete" on target "Call remote 'DELETE /users/{user-id}/contacts/{contact-id}' operation".

UserId Action Status DisplayName Mail Skip Update Details Error


ContactUser New OK (WhatIf) User2name User2email
ContactUser Remove OK (WhatIf) User1name Not required

This was working a couple months ago, it seemed to start just recently.

@PrzemyslawKlys
Copy link
Member

I don't get it, the idea of "synchronizer" is to synchronize users, not to just add them. if you want 2 users synced to everyone create your filter that synchronizes multiple users at once? If you want to do it one by one you would need to configure different GuidPrefix for it to not cleanup first user, when second is getting set up.

I don't think I understand what you're doing.

@PDMAdmin
Copy link
Author

PDMAdmin commented Jan 9, 2025

This is specifically for new employees. I tried just syncing every contact to every user, but it doubles every contact on employees work IPhones. IPhones have a fairly simple way to clear duplicates and merge them, but it is very hit or miss if the option will even appear, hence this add single user. It did work as I expected for a few months, only recently did the removal process start happening.

@PrzemyslawKlys
Copy link
Member

Why do you want to add a single user? The why would you do it for another user? I guess I don't understand..

@PDMAdmin
Copy link
Author

PDMAdmin commented Jan 9, 2025

When a new employee starts that has a phone, we add them to everyone's contacts. These contacts carry over to the other employees' work phones so that they know who is calling them/can easily call someone. When we do a regular full sync, the contacts on the work phones duplicate, and stay that way until IOS recognizes that there are duplicates and allows you to merge them. The first few times were annoying enough that we do not want to do a full sync, just add a single new user to everyone's contacts. We would add another every time a new employee comes in. If it weren't for the duplicating contacts(which I think is just a dumb IOS bug), this wouldn't be needed at all.

If all I need to do is change the GUID, I can manage that by assigning employee ids to everyone and just pulling that number to use as a GUID. At least until I find another way of doing this.

@PrzemyslawKlys
Copy link
Member

but how are you going to keep users updated? I mean we could probably add -DoNotRemove, but at the end of the day what you're doing has high impact

@PrzemyslawKlys
Copy link
Member

The current "sychronization" process works by creating it's own contacts db, so it can create duplicates because it assumes it synchronizes only users it created (by guid). It would be possible to take over full synchronization, but this has a possible drawback that it could take over some users private contacts...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants