SPList olist = oweb.Lists.TryGetList("Test_List");
if (olist != null)
{
SPListItemCollection
ocoll = olist.Items;
foreach(SPItem
oitem in ocoll)
{
SPFieldUserValueCollection
GetAllGroup = new SPFieldUserValueCollection(oweb,
Convert.ToString(oitem["SPGroups"]));
for (int i = 0; i
< GetAllGroup.Count; i++)
{
SPFieldUserValue
singlevalue = GetAllGroup[i];
if
(singlevalue.User == null) // If it is GROUP condition is true
{
SPGroup group =
oweb.Groups[singlevalue.LookupValue];
foreach (SPUser
user in group.Users)
{
if (ouser.Name ==
user.Name)
{
isuserval = true;
break;
}
}
}
else
{
if (ouser.Name ==
singlevalue.User.Name) // Checks User is Current Login User
{
isuserval = true;
break;
}
}
}
}
}
No comments:
Post a Comment