i have a list were i can add users or group to my field, I have know if u select users in people column then i can get the name and mysite url to the user, but if i select a group in people column,then i want to get the users of that group and display name and mysite url here is my code for geting users from multi field in list
Guid fieldID8 = item.Fields.GetFieldByInternalName("MyField").Id;
string valueField8 = item[fieldID8].ToString();
SPFieldUserValueCollection userField8 = (SPFieldUserValueCollection)item.Fields[fieldID8].GetFieldValue(valueField8);
DataTable dt = new DataTable();
dt.Columns.Add("ImageUrl", Type.GetType("System.String"));
dt.Columns.Add("LoginName", Type.GetType("System.String"));
dt.Columns.Add("NavigateUrl", Type.GetType("System.String"));
foreach (SPFieldUserValue value in userField8)
{
SPUser spuserField = SPContext.Current.Web.EnsureUser(value.User.ToString());
SPList userInformationList8 = SPContext.Current.Web.SiteUserInfoList;
SPListItem userItem8 = userInformationList8.Items.GetItemById(spuserField.ID);
SPServiceContext contextSp = SPServiceContext.GetContext(siteCollection);
UserProfileManager profileManager8 = new UserProfileManager(contextSp);
if (profileManager8.UserExists(spuserField.LoginName))
{
DataRow row = dt.NewRow();
var profile8 = profileManager8.GetUserProfile(spuserField.LoginName);
string personUrl8 = profile8.PersonalSite.Url;
string userNames = userItem8["Title"].ToString();
string pictureURL = userItem8["Picture"].ToString();
row["ImageUrl"] = pictureURL;
row["LoginName"] = userNames;
row["NavigateUrl"] = personUrl8;
dt.Rows.Add(row);
}
RepeaterLinks.DataSource = dt;
RepeaterLinks.DataBind();
}