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)
                         {

                         }
有帮助吗?

解决方案

SPFieldUserValue noUser = null;
item["BranchAdmin"] = noUser;
许可以下: CC-BY-SA归因
scroll top