I have a PeopleEditor:
<SharePoint:PeopleEditor ID="peopleEdit" ... SelectionSet="User,DL,SecGroup,SPGroup" />
It works flawlessly on the page, i.e. I can select AD users, Sharepoint groups and anything I would like.
The problem is that I can't find a property on the PeopleEditor of what kind of user/group is returned. Let's take the following example:
//User: John Doe - mycompany\jondoe is at position 0
//Sharepoint group: "All Site Users" is at position 1
PickerEntity pickerEntity1 = (PickerEntity).peopleEdit.ResolvedEntities[1];
// pickerEntity1.Key = "All Site Users"
// pickerEntity1.Claim = null
// pickerEntity1.DisplayText = "All Site Users"
PickerEntity pickerEntity0 = (PickerEntity).peopleEdit.ResolvedEntities[0];
// pickerEntity1.Key = "mycompany\jondoe"
// pickerEntity1.Claim = null
// pickerEntity1.DisplayText = "Doe, John"
I can do some "hackish" things like trying to cast the returned string [sic] value as a User or as a Group and do some kind of Exception based program flow (if user exists do this, else if group exist etc.), but I wouldn't consider that clean code.
Is there a better method of choosing people/groups in Sharepoint or a better method to work with the PeopleEditor?