Hi!
I was wondering if anyone know if it is possible to write information about
users to a contact selector programmatically?
I have a contact selector and is typing in a few users, validating and
everything is fine. Then, by pressing a button in the form I want to add a
user to the control. The idea is to make a new object (Person) which has the
same data structure as the other objects, already in the contact selector,
and then just to add the new user to the array of users which the contact
selector consists of. However, I don't get the new user to appear in the
contact selector.
Is there any major error in what I'm trying to do or is it possible to
accomplish?

Signature
//Sebastian
Sebastian - 13 Mar 2007 11:05 GMT
The solution is not to write to the Contact Selector itself, but to the
XDocument.DOM object.
Creating new nodes and adding them to the DOM will automatically update the
contact selector in the form.
I cloned a IXMLDOMNode in order to get a new node and then changed the
elements in the new node before adding it to the DOM using the appendChild()
method.
A snippet of the code I used:
IXMLDOMNode[] newNodes = new IXMLDOMNode[expandedUsers.Length];
for (int m = 0; m < expandedUsers.Length; m++)
{
newNodes[m] = node.cloneNode(true);
newNodes[m].firstChild.text = expandedUsers[m].DisplayName;
newNodes[m].firstChild.nextSibling.text =
expandedUsers[m].AccountId;
newNodes[m].firstChild.nextSibling.nextSibling.text =
expandedUsers[m].AccountType;
searchNode.appendChild(newNodes[m]);
}
where expandedUsers is an array of users in the Contact Selector.
Best regards

Signature
//Sebastian
> Hi!
>
[quoted text clipped - 11 lines]
> Is there any major error in what I'm trying to do or is it possible to
> accomplish?