+ Reply to Thread
Results 1 to 3 of 3
-
05-10-2010 02:17 PM #1
Junior Member
- Join Date
- Apr 2009
- Posts
- 2
Creating a profile and filling in customer user fields using user management service
I'm trying to create a new user profile and complete a profile with Custom User Fields. I prefer to do this all in one call to the .CreateUser method. The method looks to take in an array of SimpleNameValues.
The issue I'm running into is filling out all the fields. Seems like only the last item value in the array gets added to the profile. In the code below it only fills in the "Favorite Color" item. Am I misundertanding the service? Could you provide a sample of the correct way this is done?
Thanks in advance.
Private Sub AddUser()
Dim umsProxy As UserManagementServiceProxy = New UserManagementServiceProxy
umsProxy.Url = WebServiceURL
Dim userContextToken As Nullable(Of Guid) = umsProxy.AuthenticateUser("SomeUser", "blah")
If Not userContextToken.HasValue Then
Throw New Exception("Unable to authenticate user!")
End If
Dim User As String = tbUserName.Text.Trim
Dim UserProfile As SimpleNameValue(Of Object, Object)
UserProfile = New SimpleNameValue(Of Object, Object)
Dim UserProfileArray(3) As SimpleNameValue(Of Object, Object)
UserProfile.Name = "UniqueIdentifier"
UserProfile.Value = User
UserProfileArray(0) = UserProfile
UserProfile.Name = "Email"
UserProfile.Value = tbEmail.Text.Trim
UserProfileArray(1) = UserProfile
UserProfile.Name = "Birthday"
UserProfile.Value = txtBirthday.Text.Trim
UserProfileArray(2) = UserProfile
UserProfile.Name = "Favorite Color"
UserProfile.Value = "blue"
UserProfileArray(3) = UserProfile
Try
User = umsProxy.CreateUser(userContextToken, tbUserName.Text.Trim, "my password", UserProfileArray, True)
Catch ex As Exception
Throw New Exception("Unable to create user: " & ex.ToString)
End Try
umsProxy.Dispose()
umsProxy = Nothing
End SubLast edited by asm_ihill; 05-10-2010 at 02:39 PM.
-
05-10-2010 02:58 PM #2
Administrator
- Join Date
- Mar 2007
- Posts
- 385
I am not familiar with Visual Basic but based on your description of the problem it sounds like you are filling your array with identical objects. What happens if you create a new UserProfile variable every time you add an element to the array?
Last edited by pwiesner; 05-10-2010 at 03:15 PM.
-
05-10-2010 03:26 PM #3
Junior Member
- Join Date
- Apr 2009
- Posts
- 2


LinkBack URL
About LinkBacks
Reply With Quote

