How to remove the value from Person or Group column
Question
Here BranchAdmin is person or group column and from the below code i want to remove the value BranchAdmin column when the username equals to branch admin name.
try
{
foreach (SPListItem item in branchList.Items)
{
string strBranchAdmin = Convert.ToString(item["BranchAdmin"]);
if (strBranchAdmin == Username)
{
item["BranchAdmin"] = string.Empty;
}
}
branchList.Update();
}
catch (Exception ex)
{
}
Solution
SPFieldUserValue noUser = null;
item["BranchAdmin"] = noUser;
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange