How to remove the value from Person or Group column
Pregunta
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)
{
}
Solución
SPFieldUserValue noUser = null;
item["BranchAdmin"] = noUser;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a sharepoint.stackexchange