I'm having a related issue, so I hope you don't mind me hopping in here where it seems my answer may already be on the horizon.
I'm creating a custom module to manage users in a complex set up and remove a lot of the noise around the standard user management tools and make this a little easier for this particular client.
I have a module page with a UIForm tag:
<cms:UIForm ID="userForm" runat="server" AlternativeFormName="member_edit" ObjectType="cms.user" />
In Page_Load, I have the following:
userForm.Mode = FormModeEnum.Update;
userInfo = UserInfoProvider.GetUserInfo(memberId);
// userForm.Data = userInfo;
// userForm.EditedObject = userInfo;
// userForm.FieldEditingControls["UserName"].Enabled = false;
When I hit the Save button with the above code, I get:
"The object with code name '_test' already exists."
If I un-comment that last line and disable the "UserName" field, I get:
"The RedirectUrlAfterCreate property must be set for creating of the new objects."
If I comment out the LoadData() command and try setting either the .Data or .EditedObject properties and call DataBind(), it doesn't actually load anything in.
What am I missing?
BTW - Also, in Page_Load, I have this form determining if this is a new user and setting Mode = Insert and setting the RedirectUrlAfterCreate and it seems to work fine.