Hi.
I will try to be concise and thorough. My code creates a portal for a user that fills out my form. All fields on the form correspond with Profile Properties enumerated in the portal template used to create the portal. I'm having trouble adding a user, objUser, to the parent portal along with the information on the form.
Observe:
'create the portal
intPortalId = objPortalController.CreatePortal(...etc..etc)
'get the userInfo for the user we just specified in CreatePortal()
Dim objUser As UserInfo = UserController.GetUserByName(intPortalId, txtUsername.Text, True)
objUser.Profile.SetProfileProperty("CompanyName", txtCompanyName.Text)
'...etc etc. for several fields on the form.
'update their profile - this produces results that I expected.
ProfileController.UpdateUserProfile(objUser)
'add objUser to this portal - the 'parent' - this does not produce results that I expect. (keep reading)
objUser.PortalID = PortalID
UserController.CreateUser(objUser)
'my desperate attempt to make their profile work
ProfileController.UpdateUserProfile(objUser)
After executing this code, objUser is an Administrator on their portal and their profile concurs with the data entered on the form. objUser is also registered on the parent portal, but their profile properties do not concur with the data on the form. Also, objUser is not an administrator. This behavior is what I wanted, but I'm confused, because "Administrators" is listed as a role in objUser.Roles when adding to the parent portal.
Do the parent portal's Profile Properties need to match what I'm trying to add? For instance, if "CompanyName" isn't defined as a Profile Property and I'm trying to apply changes to that field, will my attempts to modify that property be ignored?
How can I add user to the parent portal, ensure their profile is accurate and they are NOT an administrator.
Thank you for your time.
Daniel