Set values in Users Custom Fields

David Pearson asked on November 9, 2017 19:50

I am working with a custom Web Part that creates new account for user sign ups. I would like to store some additional data in Custom User Fields. Is the data save via the UserInfo class or do I need to use the UserInfoProvider? Looking for some quick code examples how to Set and Get.

Thanks David

Correct Answer

Brenden Kehren answered on November 9, 2017 19:56

Assuming you're adding the new fields to the User object, you will use the UserInfo class.

UserInfo ui = new UserInfo();
ui.SetValue("MyCustomField", "my value here");

UserInfoProvider.SetUserInfo(ui);

Another option is to use an alternative form for the registration webpart and not write any code.

0 votesVote for this answer Unmark Correct answer

Recent Answers


David Pearson answered on November 9, 2017 20:04 (last edited on November 9, 2017 20:05)

Thanks Brenden, I just saw the other post too.... fun fun...... Wow a lot of UserInfo questions today...

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.