0

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

                         }
1
  • The code is not removing BranchAdmin Values from branch list
    – sachin
    Sep 10, 2015 at 15:11

1 Answer 1

1
SPFieldUserValue noUser = null;
item["BranchAdmin"] = noUser;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.