Sending an Invitation for a Survey
Hey, I'm currently working on a vb.net page where I want to do the following through the webservice/API.:
1. Confirm if a user exists. If he exists, then get the details for the user (guidUserID).
2. If the user doesn't exist, create the user and get the details stored along with the guidUserID.
3. Finally, fire off an invitation to the existing or newly created user for a particular survery. The survey will have already been created using the Checkbox Survey Server web pages in advance.
For steps 1 and 2, I believe I'm pretty much there using the webservice. It's when I get to step 3 where I'm bogging down. I know there is an older example of doing this from another post. That post is written in C# and doesn't appear to be using the webservice. I'm unable to get valid references for that other code to work correctly. Here's what I have below in regards to my code. Thoughts on the solution anyone?
Dim objInvitation As Checkbox.Web.Services.InvitationManagement
Dim guidUserToken As Guid
Dim guidUserID As Guid
Dim test As String()
Dim value As String
Dim profileProps As New List(Of SimpleNameValue(Of Object, Object))()
Dim profile As SimpleNameValue(Of Object, Object)()
Dim strCurrentEmail As String
wsProxy.Url = "http://localhost/checkbox/services/usermanagementservice.asmx"
guidUserToken = wsProxy.AuthenticateUser("admin", "admin")
If guidUserToken <> Guid.Empty Then
'test = wsProxy.GetUserIdentities(guidUserToken, "UserName", "TestUser")
'Response.Write(test(0))
'Create the profile for the new user
profileProps.Add(New SimpleNameValue(Of Object, Object)("FirstName", "Test"))
profileProps.Add(New SimpleNameValue(Of Object, Object)("LastName", "Test"))
profileProps.Add(New SimpleNameValue(Of Object, Object)("Email", "test@domain.com"))
'Create the user
wsProxy.CreateUser(guidUserToken, "Test", "password", profileProps.ToArray(), True)
profile = wsProxy.GetUserProfile(guidUserToken, "Test")
'Find the "LastName" property and update it
For Each profileProp As SimpleNameValue(Of Object, Object) In profile
'Response.Write("Name: " & profileProp.Name.ToString() & " ")
'Response.Write("Value: " & profileProp.Value.ToString & " ")
If DirectCast(profileProp.Name, String) = "Email" Then
strCurrentEmail = profileProp.Value.ToString()
Response.Write(strCurrentEmail)
End If
Next
End If
'this is the point where I would need code for firing off a survey
objInvitation.AddUsersToInvitation(
end sub
|