views:

487

answers:

0

I have created a web part with a PeopleEditor control (called peADLoopUp) and a button, and basically, when a user enters people into the PeopleEditor control (which gets those people from Active Directory), they click the button and it loops through the people they entered into the PeopleEditor control and adds those people to a custom SharePoint list I created.

If I loop through the ResolvedEntities collection of peADLookUp, it works fine. But before I figured that out, I was looping through the Entities collection instead, and when I did, the only way the collection would have any objects in it was if I referenced the CommaSeparatedAccounts attribute: Dim blah As String = peADLookUp.CommaSeparatedAccounts. The variable blah wasn't being used anywhere at all, I just simply had to make a call to CommaSeparatedAccounts or else Entities would not have any objects in it, even though I added people to it and clicked the Save button.

A code snippet is below.

For Each account as PickerEntity In peADLoopUp.Entities
   strDisplayName = account.EntityData("DisplayName").ToString()
   strEmail = account.EntityData("Email").ToString()
   strTitle = account.EntityData("Title").ToString()
Next

The full code of the whole web part, working perfectly fine, is here at How to populate a custom contact list from AD. In that code, I am referencing the collection that works fine, ResolvedEntities. But to see what I am talking about, change ResolvedEntites to Entities and you will see it no longer works - until you reference CommaSeparatedAccounts. Thankfully this isn't a pressing issue as I found a solution, but if anyone has any ideas on why this is happening, I'd love to hear it.