6

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.

5

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.

3

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.

  • 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

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.