Remove duplicate contacts in Lync
I have been fighting quite a bit with this one. In short – yes, the contacts can be deleted one by one via the OWA – but with 2500 duplicates – and unable to mark multiple contacts, I didn’t really think this was the way to go.
So after a lot of trial and error – this is what I ended up with, and it finally worked (for me 🙂 ) – and i had a few, a lot happier users!
So! To jump right in to it. You will need access to the affected users Lync and Outlook client. You will also need admin-rights on the Exchange server, so we can use some epic PowerShell 🙂
On the Lync Client, Set Personal Information Manager to None.
Start with disabling the link between Outlook and Lync contacts:
The Lync contacts exists on the Lync server – NOT in the mailbox. Therefore, we do not really care about those – only the contacts in Outlook.
On the Exchange server, open a PowerShell
First of all – backup the contacts in the mailbox. (remember to change user and path. Path MUST be a share.)
New-MailboxExportRequest USER -IncludeFolders “#Contacts#” -ExcludeDumpster -FilePath \\server\share\file.pst -name USER_Cont -acceptlargedataloss -baditemlimit 999
Where -name is the Export JOB name.
This produces a .PST file you can open directly with Outlook when we need to import them again.
(You could of course do this from the PowerShell as well, but ill leave it up to you 😉 )
Now delete the contacts.. WARNING – this deletes ALL contacs in the mailbox.. if you have some sort of clever folder structure with contacts outside the “#Contact#” folder – remember to export them.
Remember to change USER.
Search-Mailbox -Identity USER -SearchQuery “kind:contacts” -DeleteContent
On the Client
Now – open the .pst file you exported before in Outlook (FILE –> OPEN) and go to the PEOPLE section.
Drag all the contacts from the file to your mailbox contacts. This takes a while depending on the number of contacts.
Finally – go to Lync – and enable the Personal Information manager again:
Both phones, outlook and what not should be up to date very quickly with the contacts, and the Lync Contacts should return again within a few minutes.
All done! 🙂