Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to get Sid values for picker entities.. PickerEntity does not have any Sid field..

I can check every PickerEntity find the type (i.e. user, group) then load SPUser etc to get the Sid.

Is there an cleaner way to get Sid's from PickerEntities ?

thanks!

share|improve this question
add comment

2 Answers

Something like this should do the trick:

ServerContext ctx = ServerContext.GetContext("Litware SSP");
UserProfileManager mgr = new UserProfileManager(ctx);

PickerEntity selectedEntity = (PickerEntity)PeopleEditor1.ResolvedEntities[0];
UserProfile profile = mgr.GetUserProfile(selectedEntity.Key);

string selectedSid = profile["SID"].Value.ToString();

Read the post PeopleEditor Control for details.

share|improve this answer
    
thanks,but that functionality requires MOSS, I have to be compatible with WSS 3.. –  Gokhan B. Jun 15 '11 at 13:59
add comment

The GetUserInfo operation of the UserGroup.asmx web service contains the SID that can be parsed out if you can utilize that.

<?xml version="1.0"?>
<xml>
<GetUserInfo xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/"><User IsDomainGroup="False" IsSiteAdmin="False" Notes="" Email="myemail@mydomain.com" LoginName="domain\alexandere" Name="Pirate, Eric" Sid="S-1-5-21-2072177302-1958620249-3085007271-234531" ID="1"/>
</GetUserInfo>
</xml>

Meaning that after a user is selected from the people picker, you can use that value to call the web service to retrieve the SID.

share|improve this answer
    
I try not to use WebService since I'm already in sharepoint context.. do you know any other way ? –  Gokhan B. Jun 15 '11 at 13:59
    
Not that I'm aware of, but I'm not a C# developer. I deal mainly with jQuery and DVWPs so I'm used to the web services route. –  PirateEric Jun 15 '11 at 14:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.