3

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!

1

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.

  • thanks,but that functionality requires MOSS, I have to be compatible with WSS 3.. – Gokhan B. Jun 15 '11 at 13:59
0

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.

  • 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. – Eric Alexander Jun 15 '11 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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