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

Does every user that belongs to a site collection or a group in that site collection, have a user.ID?

I am iterating through a list of SPFieldUserValueCollection and am comparing the SPFieldUserValue.User.ID with the SPContext.Current.Web.CurrentUser.ID and want to make sure they will compare accurately.

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Yes, every user will have an ID. SPUser.ID is the integer ID of the user in the site collection. However, the ID is specific only to that specific site collection.

I would recommend using SPUser.LoginName instead.

share|improve this answer
add comment

SPUser.ID only refers to the Item ID of their entry in that site collection's User Information List, so it's never guaranteed to be unique across a farm.

share|improve this answer
    
I understand it might not be unique across farms, but do you know if ever user in that farm will have an ID regardless if they are a member of the farm or just member of a group that belongs to the farm? –  Meyer Denney Jun 7 '11 at 23:04
1  
I would clarify that it isn't even unique across site collections. –  Kit Menke Jun 7 '11 at 23:53
    
@Kit yeah, that's what I meant, though I guess how I wrote it could infer that I meant that it could be unique within a web app. Which it isn't. :) –  James Love Jun 8 '11 at 7:15
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.