//Method that uses the IBM Sametime Helper Library to request //the list of IBM Sametime Connect Client contacts, and populate //the UI List control with the returned list of contacts. private void getSametimeContacts() { //Create the Sametime Helper object. STHelperLib.SametimeHelper stHelper = new STHelperLib.SametimeHelper(); //Sametime Group type String strGroupType = "all"; //Define an object to hold Sametime Contact Group names. Object objGroups = null; //Invoke the Sametime Helper to populate the group names object. stHelper.GetSametimeGroups(strGroupType, out objGroups); if (objGroups != null) { //Assign the array that has the Sametime Contact Group names. Array arrGroups = ((Array)objGroups); //Loop through the Sametime Contact Group names and retrieve //the Sametime Contact names for each group. for (int i = 0; i < arrGroups.Length; i++) { //Assign the current group name. String strGroupName = (String)arrGroups.GetValue(i); //Define array to hold Sametime Contact Contact //names for the current group Object objContacts = null; //Invoke the Sametime Helper to populate the contact //names object for the current group. stHelper.GetContacts(strGroupName, out objContacts); if (objContacts != null) { //Assign the array that has the current group contact names. Array arrContacts = ((Array)objContacts); //Loop through the Sametime Contact names and add each name //to the List control. for (int ct = 0; ct < arrContacts.Length; ct++) { //Assign the current contact. String contact = arrContacts.GetValue(ct).ToString(); //Add the contact name to the List control. listContacts.Items.Add(contact); } } } } }
public STHelperExampleEventHandler() { //Create the Sametime Helper object. stHelper = new STHelperLib.SametimeHelper(); //Register the Sametime Helper event callbacks. //event _ISametimeHelperEvents_OnPersonUpdateEventHandler stHelper.OnPersonUpdate += new STHelperLib._ISametimeHelperEvents_OnPersonUpdateEventHandler(this.OnPersonUpdateEventHandler); //event _ISametimeHelperEvents_OnCapabilityEventEventHandler stHelper.OnCapabilityEvent += new STHelperLib._ISametimeHelperEvents_OnCapabilityEventEventHandler(this.OnCapabilityEventEventHandler); //event _ISametimeHelperEvents_OnDirectoryResolveEventHandler stHelper.OnDirectoryResolve += new STHelperLib._ISametimeHelperEvents_OnDirectoryResolveEventHandler(this.OnDirectoryResolveEventHandler); //event _ISametimeHelperEvents_OnEvictWatchEventHandler stHelper.OnEvictWatch += new STHelperLib._ISametimeHelperEvents_OnEvictWatchEventHandler(this.OnEvictWatchEventHandler); //event _ISametimeHelperEvents_OnSametimeUnavailableEventHandler stHelper.OnSametimeUnavailable += new STHelperLib._ISametimeHelperEvents_OnSametimeUnavailableEventHandler(this.OnSametimeUnavailableEventHandler); }