woensdag 25 april 2012

How to use CSContactImporter for OCS and Lync

Recently, a new tool came available for OCS and Lync to import contacts or contact groups into Lync or OCS. This can be a great addition if you want to provide standard contact lists to new users for example, or add contacts or groups for all of your existing users.

A quote from MS Download Center :

“ Small tool for OCS 2007 R2 and Lync Server 2010 which allows an administrator to import contacts into the database. Importers are included for AIM, Yahoo Messenger, Windows Live Messenger, and for generic text based lists. This tool is provided as-is and is not supported by Microsoft support. “

So, where do I get it, what do I need, how does it look like and how can I import contacts? At the end of this blog, you will know.

You can download the tool from Microsoft Download center
Download both files and run Setup.exe.

One of the system requirements is Microsoft.NET 4.0 for Lync Server 2010.
Make sure this is installed.

The tools has a graphical interface, once opened it looks like this.


It allows you to import contacts to OCS or Lync from:

AOL Instant Messenger (blt export, version 2)

Windows Live (csv export)
- Cannot import groups
- Non Live e-mail addresses may not import properly.

YAHOO Messenger (Yahoo csv export)
- Cannot import groups

Plain Text
- User SIP address, add comma and group name if you want to place them in groups
  For example:

It allows you to import a single contact, or a batch of contacts.
We will discuss the batch option, as this is the most interesting and probably most used.

You need DBImpExp.exe to export contacts from Lync contact store to an XML file. You can only export all contacts, or a single contact. So if you want to add contacts using CSContactImporter, you do it for a single users, or all users.
The tool can be found at:
C:\Program Files\Common Files\Microsoft Lync Server 2010\Support
To export contacts using Lync standard :
“dbimpexp.exe /hrxmlfile:”c:\Export\lynccontacts.xml”
To export contacts using Lync Enterprise :
“dbimpexp.exe /hrxmlfile:”c:\Export\lynccontacts.xml” /sqldatabase:”sql server hostname”\”instance name”
For a single user, just add /user:sip@domain.com to the command.

After you exported the contacts to the XML you can use CSContactImporter to add contacts or groups to the contacts lists.
Windows Live, Yahoo and AOL do not need extra explanation, because contacts can be exported. For plain text I will make an example.
Lets say you want to add 4 users and place them in a group called UC Team, create a text file that looks like this and save it like newusers.txt :

User1@domain.com, UC Team
User2@domain.com, UC Team
User3@domain.com, UC Team
User4@domain.com, UC Team

Once you configure the right files, click generate and CSContactImporter creates a destination DBImpExp file that needs to be imported in the Lync contact store using DBImpExp.exe. The option “ Carry over groups” updates groups if they already exist.


To import contacts using Lync standard :
”dbimpexp.exe /import /hrxmlfile:”c:\Export\lynccontacts_new.xml” /restype:all”
To export contacts using Lync Enterprise :
“dbimpexp.exe /import /hrxmlfile:”c:\Export\lynccontacts_new.xml” /sqldatabase:”sql server hostname”\”instance name” /restype:all”
For a single user, just add /user:sip@domain.com to the command.

Once imported, the contacts and groups should be added when the users logs out and back in.

Things you should keep in mind :

  • Microsoft does not provide support if something goed wrong. ( Me neither!! )
  • Try this with one users first, before adding users to everyone’s contact list.
  • Make sure all files are in the same folder.
  • When using the /user switch , DBImpExp.exe is case sensitive, Sip address should be exactly like in the Lync database.
  • If a user adds contacts between the export and import, those contacts are lost.
  • If you don’t know what you are doing, don’t do anything at all!

I think this is a great addition to all the existing tools out there!

1 opmerking: