What is CSContactImporter and how can it be used

CSContactImporter was released 12.04.2012 and can be downloaded here: http://www.microsoft.com/download/en/details.aspx?id=29558

At first i thought it was a PowerShell script to add contacts to a users contact list since the name starts with CS. After downloading and installing it I found out it was a program that enables you to do this from a GUI.

What does it do?

  • It lets you import contacts into Lync\OCS from
    • AOL Instant Messenger (blt export, version 2)
    • Windows Live (csv export)
      • Cannot import groups
      • Because some WLM contacts may not have msn domain the contacts may be imported wrong and not working
      • Example: sh@msunified.net needs to be in the format sh(msunified.net)@msn.com in Lync, when its not imported like this it will fail so beware
    • YAHOO Messenger (Yahoo csv export)
      • Cannot import groups
    • Plain Text
      • One line per contact, optionally add comma and group name
      • Example: sh@msunified.net,Sales
      • For distribution groups, enter the group email and then _dg_ as the group name
      • Example: accounting@contoso.com,_dg_
  • The contacts can be imported to a single user or a group of users using the batch option
  • You need to use dbimpexp.exe to export all contacts or indivdual contacts from the Lync SQL contact store
    • The tool is a Lync native tool found under C:\Program Files\Common Files\Microsoft Lync Server 2010\Support
  • After you have exported your users you can use the CSContactImporter to append the contacts to the users list
  • Then you need to use dbimpexp.exe to import the users contacts to the Lync SQL contact store again

What does it look like?

Using it in a scenario

To me the batch import is the most interesting scenario. Being able to prepopulate a Lync users contact list with its closest peers in the office or his og her virtual coworkers. The ability to add a default group to all contact lists with telepresence rooms or IT support seems like a usable scenario. Espcially when its the first time users start using Lync, I bet the new users spends their first time in Lync trying to find their coworkers.

To populate a few users with their closest coworkers in a group

  • You need to export all users contact list from the Lync contact database, even though the contact lists is empty
    • For Standard Edition run the command: dbimpexp.exe /hrxmlfile:”c:\TempCSCI\users.xml”
    • For Enterprise Edition run the command: dbimpexp.exe /hrxmlfile:”c:\TempCSCI\users.xml” /sqldatabase:”sql server hostname”\”instance name”
    • It is not possbile to export groups of users using this tool, only one or all
  • Create the contacts you want imported into the users contact lists in a txt
    • sh@msunified.net,Sales
    • vf@msunified.net,Sales
    • me@msunified.net,Sales
    • Where sales is the group name, if a group exists from before it will update this group if you check “Carry over groups”
  • If you just want to add a distribution group instead use the following syntax
    • sales@msunified.net,_dg_
    • Personally I don’t like using distribution groups because sometimes the group expansion is not always that snappy and not all clients support them
  • You need to create one file per user with the content above and the filename must match the SIP address of the user they will be imported into
    • sh@msunified.net.txt
  • Make sure all the files are stored in the same folder
  • Populate CSContactImporter as shown below and hit Generate
    • The importer will only alter the users specified in the txt files and no other users

  • A log file will be written to the same folder and you can open it to see if any users failed to import
  • Now you need to use dbimpexp.exe to import the new contact lists
    • For Standard Edition run the command: dbimpexp.exe /import /hrxmlfile:”c:\TempCSCI\users_merged.xml” /restype:all
    • For Enterprise Edition run the command: dbimpexp.exe /import /hrxmlfile:”c:\TempCSCI\users_merged.xml” /sqldatabase:”sql server hostname”\”instance name” /restype:all
  • After the import is finished, the users need to log out of Lync and then in again to see the new groups and contacts
    • Remember that all changes users have done to their contact lists between you export and import will be lost, make sure to do this in low traffic periods

Conclusion

The tool works and it is now possible to import contacts form other IM solutions or predefening contacts based on AD groups or office location before users log on using this tool. If you have lots of users a lot of these steps may be automated using PowerShell, like finding the users you want to have in your group, creating the txt files and dbimpexp export\import. The only manual thing here is the tool itself. I am sure a cool script to handle this will be written as the community will get more hands-on.

You may also want to try out LyncAddContacts.vbs – VBS Script to add Groups to multiple contacts created by MVP Jeff Guillet. The main difference between CSImportContact and LyncAddContacts:

  • CSImportContacts can new users and groups based on text files or import from another IM program and is a GUI
  • LyncAddContacts needs to have a defined dummy user with only the groups or users you want to import and is a VBS script

3 thoughts on “What is CSContactImporter and how can it be used

  1. Hi,
    I was unable to import lync user contacts using this tool. For Importing contacts i have done the following things:

    Using dbimpexp.exe tool i have exported the contacts of particular user. for this i have used following command:

    dbimpexp.exe /hrxmlfile:contacts.xml /user: /sqlserver:sqlservername

    i used this CSContactImporter tool for generating xml file file which is going to used for importing contacts.

    Now i have used dbimpexp.exe tool for importing contact for perticular user using xml file generated using CSContactImporter tool.
    for this i have used following command:

    dbimpexp.exe /import /hrxmlfile:”c:\TempCSCI\” /user: /sqldatabase:” sql server hostname”\”instance name” /restype:all

    but above command gave me following error message as:

    “Errors were encountered during import. C:\Users\administrator.PLATFORM2012\AppData\Local\Temp\1\tmpF47.tmp contains a log of all the errors.
    C:\Users\administrator.PLATFORM2012\AppData\Local\Temp\1\tmpF48.tmp contains the xml for all the failed users.
    Reindexing all tables and updating statistics.”

    Can anyone please tell me why this is happening?

    Thanks
    Swapnil

    • Hi ,
      tmpf48.tmp file conatins the following logs:

      “Error: Failed to import Homed Resource u20@domain.lab.
      AffectedUser: u20@domain.lab
      Details: Procedure or function ‘UserMgmtSetHomedResourceDataXml’ expects parameter ‘@_RoutingGroupId’, which was not supplied.”

      anyone having any idea about this?

      Thanks
      Swapnil

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s