Script: Get a Lync User Contacts List

Update: 28-May-2014 – Just released Version 0.2 which fixes the issue with connecting to local SQL server. thanks to Paul Bloem for the feedback.


Recently I had a weird problem with a Lync client in which his contacts list were not shown on his mobile device, but did on the Lync desktop client.

To make a long story short, the only solution was to remove the Lync user from the Lync environment and re-enable it again and adding all of his contacts from scratch without the option to use Import-CsUserDate (as the old data was exported in a corrupted XML structure).

In order to prepare the user for that action, I decided to export all of his existing contacts list, unfortunately I couldn’t find an easy way in which I can just provide the user with a list of his Contacts list, as the Export-CsUserData is exporting it to an XML file which is not the most convenient way to read a file from an end user perspective.

That was the trigger for writing the following script. This script will output a Lync User contacts list to a selected export option (Screen, CSV or Gridview).

This script is meant to list the contact list of a user in a simple way, taken out of the Lync local SQL database and it cannot be used for import purposes unless combined with other script such as Bulk Import Contacts for Lync 2013 which allow you import contacts from a CSV file.

Download:

Download link

Source:

the original SQL query is taken from the following link

Output Examples:

4 Comments

  1. Pingback: Weekly IT Newsletter – May 19-23, 2014 | Just a Lync Guy

  2. Itzik Menashe

    HI Guy

    how can we migrate skype contact list to Lync ?

    1. Guy Bachar (Post author)

      Hi Itzik,

      unfortunately i’m not familiar with any way to do that, the main problem is that in order for a Skype contact to work with Lync, the user needs to use his Microsoft ID account and it’s not always the case.
      If you do have a list of contact, you can import them by using 3rd party script to Lync.

      As for Skype, according to their FAQ, it’s not currently possible to export it: https://support.skype.com/en/faq/FA12158/can-i-transfer-contacts-from-one-skype-account-to-another

      Regards,
      Guy

  3. Dave

    This runs without errors in Skype For Business 2015 however if you’re using distribution groups to build a contact list it shows you don’t have any contacts. The distribution groups might be why my export/import csuserdata isn’t working too! Thanks for the script Guy!!

Comments are closed.