Hi All,
I'm struggling to save extended attributes... If I analyse "MyUser" in Visual Studio after SetExtendedAttribute is called - the info seems to be in place... But when I come to retrive it - there's no elements in the ExtendedAttributes array.
... can you see what I'm doing wrong?
Thanks,
Niki
P.s. can someone point me in the direction of some documentation? - I'll I seem to have found are these forums...
// Create a user User MyUser = new User(SignInName); // Load IProfileBase ProfileBase = MemberRoleProfileProvider.Instance().Profiles.Create(SignInName, true); Profile MyProfile = new Profile(ProfileBase); MyUser.RefreshUserProfile(MyProfile); MyUser.RefreshMembershipUser(MemberRoleProfileProvider.Instance().Members.GetUser(SignInName)); // Set MyUser.SetExtendedAttribute(Attribute, Value); // Save MyProfile.Save(); // Update CommunityServer.Users.UpdateUser(MyUser);
club.inspired-entrepreneur.com
When creating a user and setting extended attributes, I'd suggest following this model:
User user = new User(); user.Username = UserNameTextBox.Text;user.Email = EmailAddressTextBox.Text;user.Password = PasswordTextBox.Text.Trim(); user.SetExtendedAttribute(KEY, VALUE); Users.Create(user, false, false); // you may want to check that this returns CreateUserStatus.Created
User user = new User();
user.Username = UserNameTextBox.Text;user.Email = EmailAddressTextBox.Text;user.Password = PasswordTextBox.Text.Trim();
user.SetExtendedAttribute(KEY, VALUE);
Users.Create(user, false, false); // you may want to check that this returns CreateUserStatus.Created
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com