/// <summary> /// Create a new network user. /// Because no roles or permissions are explicitly set, the new user will have the "Report Viewer" and "Respondent" role /// and will only be able to access public surveys and reports. /// </summary> /// <param name="authenticationToken">Encrypted forms auth token identifying the requesting user.</param> /// <param name="username">The new user's username.</param> /// <param name="domain">The new user's domain.</param> /// <param name="emailAddress">The new user's email address.</param> /// <param name="profileProperties">(Optional) A list of profile properties to associate with the user.</param> private static string CreateNetworkUser( string authenticationToken, string username, string domain, string emailAddress, IList<KeyValuePair<string, string>> profileProperties = null) { /* * If you are unable to reference System.Service make sure that the project is configured to * use the full 4.0 framework and not the client profile. */ var proxy = new UserManagementServiceClient(); var profile = BuildProfile(profileProperties); var result = proxy.CreateNetworkUser( authenticationToken, username, domain, emailAddress, profile, true); /*When true, if a user with the same name exists, update that user.*/ // Handle exceptions if (!result.CallSuccess) { Console.WriteLine(result.FailureMessage); return null; } return result.ResultData; }