You have person or group field in SharePoint list and you want to programmatically get the user or person. The below code to gets SPUser from User or Group field in the list when multiple choice and Groups are not allowed in the field: //get SPUser SPFieldUser userField = (SPFieldUser)item.Fields.GetField("Users"); SPFieldUserValue userFieldValue = (SPFieldUserValue)userField.GetFieldValue(item["Users"].ToString()); SPUser user = userFieldValue.User; This part of code would help you to get SPUser when multiple choice is allowed and groups are not allowed: //Multiple choices are allowed SPFieldUser userField = (SPFieldUser)item.Fields.GetField("Users"); SPFieldUserValueCollection userFieldValueCollection = (SPFieldUserValueCollection)userField.GetFieldValue(item["Users"].ToString()); foreach (SPFieldUserValue userFieldValue in userFieldValueCollection) { Console.WriteLine(" " + userFieldValue.User.LoginName); } And when group...
Idea, Thought, Opinion, Feedback, Challenges, Experiences on Microsoft platform.
It was hard to think about Microsoft Azure DevOps Solutions (beta) before the introduction of AZ-400 Dumps dumps material. I have passed this certification easily by going through this dumps material. All the topics were well covered by the experts. I got a comprehensive view of the field and confidently solved all the questions in the final test.
ReplyDeleteExcited about the upcoming Christmas offer at DumpsPass4Sure! The 20% discount on Azure AZ-400 Study Material is a game-changer. Elevate your skills with premium resources without breaking the bank. Don't miss out on this incredible opportunity to excel in your certification journey. Cheers to a festive season of learning and savings!
ReplyDelete