Assign a VPN configuration to a user account

To assign a VPN configuration to a user account, you can use the assignVPNConfigurationToUser() method.
Before you begin: Retrieve the following variables:
  • userID integer for the user account that you want to assign the VPN configuration to
  • configName string for the name of the VPN configuration
  1. Invoke findVPNConfigurations() to retrieve all VPN configurations.
    FindVPNConfigurations findRequest = new findVPNConfigurations();
    findRequest.locale = locale;
    findRequest.includePolicyItems = true;
    FindVPNConfigurationsResponse findResponse = coreWebService.findVPNConfigurations(findRequest);
    FindVPNConfigurationsResult findResult = findResponse.returnValue;
  2. Check the result for errors and handle any errors.
    if (findResult.findVPNConfigurationsReturnStatus.code != FindVPNConfigurationsReturnStatusEnumType.SUCCESS) 
           // handle any errors
  3. Search for the VPN configuration that you want to assign to the user account.
    if (findResult.ITPolicies.Length>0) 
           for (int i=0; i<findResult.itPolicies.size; i++) 
  4. Retrieve the VPN configuration ID.
                    int VPNConfigId = findResult.itPolicies[i].policyId;
  5. Invoke assignVPNConfigurationToUser().
                     AssignVPNConfigurationToUser request = new assignVPNConfigurationToUser();
                     request.vpnBaseConfigSetId = VPNConfigId;
                     request.userId = userID;
                     AssignVPNConfigurationsToUserResponse response = coreWebService.assignVPNConfigurationToUser(request);
                     AssignVPNConfigurationsToUserResult result = response.returnValue;
  6. Check the result for errors and handle any errors.
                     if (result.assignVPNConfigurationToUserReturnStatus.code != AssignVPNConfigurationToUserReturnStatusEnumType.SUCCESS) {
                           //handle any errors

Was this information helpful? Send us your comments.