1

I try to get ListItem by unique value, as Mail. Every person has it's own unique mail address. I need to edit some of list data by looking up the Mail address and then edit items on this row. It is easily done by ID, but how to get ID with value?

It would be helpful, if this code can be written in C# not Query. If it is possible.

SPList

items = web.SiteUserInfoList;
SPListItem item = // Get item by unique value here. items.GetItemById(x) would return it by Id.
2

In user information list, the itemids are the user id's of the user. To get the user id use the below method

SPUser user = SPContext.Current.Web.EnsureUser("LOGON NAME");`

// The actual User Information is within this SPListItem by querying with ID got from previous step

SPListItem userItem = userInformationList.Items.GetItemById(user.ID);
0
1

If you want to have a clone of the "GetItemById" function, I'm afraid it's not possible, only the ID has its dedicated extraction method. You have to build you own CAML query. If you need help with this, tell me.

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.