Obtaining an Office Communications Server User Instance ID

Communications Server 2007 Server SDK Documentation

Obtaining an Office Communications Server User Instance ID

The following code sample demonstrates how to obtain an Office Communications Server user's instance ID based on a supplied URI for the user.

To execute this code successfully, you must be a member of the Office Communications Server Domain User Admin group.

Public Function ObtainLCUserInstanceID(URI)

	' Connect to the WMI server.
	Set wmiServer = CreateObject("WbemScripting.SWbemLocator").ConnectServer()

	'Do error checking here.

	Query = "SELECT InstanceID FROM MSFT_SIPESUserSetting where PrimaryURI = '" & URI & "'"
	Set LCUserEnum = wmiServer.ExecQuery(Query)

	'Do error checking here.

	WScript.Echo "The following Office Communications User Instance IDs matched the supplied URI:"

	For each LCUser in LCUserEnum			

		WScript.Echo LCUser.InstanceID

	ObtainLCUserInstanceID = true

End Function
  What did you think of this topic?
  © 2007 Microsoft Corporation. All rights reserved.