Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2007

Tip: Looking for answers? Try searching our database.

Writing information into Contact Selector

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebastian - 09 Mar 2007 14:26 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.