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.
I did by my best to get utmost grades with MS-301 Exam Dumps and I have successfully secured unique position. My efforts would not have brought such good results without consulting MS-301 Exam Q&A. I have to pay thanks to RealExamDumps for compiling such compact study material.
ReplyDeleteIt was not simple to dare say pass my IT exam before I downloaded Microsoft MS-301 dumps PDF from Exam4Help.com. I got confidence when I perused the informative and useful questions and answers written by the well qualified experts. I got a thorough understanding of the syllabus with Microsoft MS-301 questions and answers and attempted all the questions confidently.
ReplyDelete
ReplyDeleteChoice of an acute study material was important for me so I chose MS-301 Dumps PDF. I went through this informative guide and got an astute knowledge of the field. Now I have passed my exam with the help of MS-301 Dumps. I say thanks to Exam4Lead for all the help.