Writing information into Contact Selector

S

Sebastian

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?
 
S

Sebastian

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top