A question came up recently where a Lync 2013 admin was pre-populating contacts for users. They were using a custom XML that was generated from a Export-CSUserData dump from a template Lync user. (If you want to know more about how to do that, I can explain another time, just ask). They then modified the DocItemSet file within the exported zip to match each user and were running either Import-CSUserData or Update-CSUserData to merge the data into the user’s contact lists. The issue was that they couldn’t figure out how to set the privacy relationship within this file. This took a bit of reverse engineering, so take this with a grain of salt, but the key is to look at the container tags.
In the above pic, you’ll see under DocItemSet.DocItem.Data.HomedResource.Containers there are several containers each with a unique ContainerNumber. The important ones to know are the following:
- 100 = External Contacts
- 200 = Colleagues
- 300 = WorkGroup
- 400 = Friends and Family
- 32000 = Blocked
- No container = Default
Adding the <UserMember Member=”firstname.lastname@example.org”/> tag directly under the appropriate container number and merging the data using Update-CsUserData appears to properly reassign the user’s privacy relationship. Removing all <UserMember> tags that correspond to a user sets them back to the default relationship, for internal users this would be Colleagues.
For more information on running the Export-CSUserData, Import-CSUserData, and Update-CSUser data commands, please see the TechNet Wiki article below: http://social.technet.microsoft.com/wiki/contents/articles/25001.backing-up-and-restoring-lync-2013-contacts.aspx
For more information on the differences between privacy relationships, please look here: http://office.microsoft.com/en-us/lync-help/control-access-to-your-presence-information-in-lync-HA102925421.aspx