UserProfileFactoryNewUserProfile Method |
Namespace: AskiaPortalCmn
Create a new user profile and save it
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D")); var contextValidation = context.Validate(); if (!contextValidation.Success) { throw contextValidation.Exception; } var userProfile = UserProfileFactory.NewUserProfile(context); if (userProfile == null) { Console.Error.WriteLine("Could not create a new user profile"); return; } userProfile.Name = "Survey scripter"; var saveResult = userProfile.Save(); if (saveResult.Success) { Console.WriteLine("The user profile `{0}` (Id={1}) was successfully saved", userProfile.Name, userProfile.Id); } else { Console.Error.Write(saveResult.Exception.Message); }