.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to get User Email ID from Person or Group field of SharePoint List

Posted By:Sagar Pardeshi       Posted Date: September 12, 2013    Points: 40    Category: SharePoint    URL: http://www.dotnetspark.com  

In sharepoint List Person or Group field Select Multiple person option that time code thorugh access email id
 

using (SPSite oSite = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb oWeb = oSite.OpenWeb())
                {
                    SPList Olist = oWeb.Lists["EmplyoeeList"];

                    SPListItemCollection oItems = Olist .Items;
                    string TOEmailADD = string.Empty;
                    foreach (SPItem oListItem in oItems)
                    {

                        string to = string.Empty;

                        SPFieldUserValueCollection AssignedTo = (SPFieldUserValueCollection)oListItem["AllMgr"];

                        foreach (SPFieldUserValue uv in AssignedTo)
                        {

                      TOEmailADD = TOEmailADD +uv.User.Email + ";"; 

                        }

                TOEmailADD = TOEmailADD .TrimEnd(';');
              }
            }
   }


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend