Remove a WLAN configuration from a user account

To remove a WLAN configuration from a user account, you can use the unassignWLANConfigurationFromUser() method.
Before you begin: Retrieve the following variables:
  • userID integer for the user account that you want to remove the WLAN configuration from
  • configName string for the name of the WLAN configuration
  1. Specify the attributes to load with the user account that you want to remove the WLAN configuration from. To load the WLAN configurations of the user account, you must specify the loadUserWLANVPNVOIPConfigurations attribute as true.
    getUser userRequest = new getUser();
    userRequest.loadUserServiceAttributes = false;
    userRequest.loadUserDeviceConfigurationServiceAttributes = false;
    userRequest.loadUserResolvedGroups = false;
    userRequest.loadUserResolvedGroupIds = false;
    userRequest.loadUserGroups = false;
    userRequest.loadUserWLANVPNVOIPConfigurations = true;
  2. Retrieve the user account object.
    getUserResponse userResponse = coreWebService.getUser(getUserRequest);
    getUserResult userResult = userResponse.returnValue;
  3. Check the result for errors and handle any errors.
    if (result.getUserReturnStatus.code != GetUserReturnStatusEnumType.SUCCESS) 
          // handle any errors
  4. Retrieve the user account object.
    User user = result.user;
  5. Search the result for the WLAN configuration you want to remove from the user account.
    for (int i=0; i < user.iTPolicyWLANVPNVOIPAttributes.Length; i++) 
           if (user.itPolicyWLANVPNVOIPAttributes[i].GetType.Equals(typeof(WLANConfigurations)))
               for (int j=0; j<user.itPolicyWLANVPNVOIPAttributes[i].Length; j++)
  6. Retrieve the WLAN Configuration ID and invoke unassignWLANConfigurationFromUser().
                        int wlanConfigID = ITPolicyWLANVPNVOIPAttributes[i].vpnConfigurations[j].wLANBaseConfigSetsId;
                        unassignWLANConfigurationFromUser removeRequest = new unassignWLANConfigurationFromUser();
                        removeRequest.wlanConfigId = wlanConfigID;
                        removeRequest.userId = userID;
                        unassignWLANConfigurationFromUserResponse wlanResponse = coreWebService.unassignWLANConfigurationFromUser(removeRequest);
                        unassignWLANConfigurationFromUserResult wlanResult = wlanResponse.returnValue;
  7. Check the result for errors, and handle any errors.
                         if (wlanResult.getUnassignWLANConfigurationFromUserReturnStatus().getCode() != UnassignWLANConfigurationFromUserReturnStatusEnumType.SUCCESS) 
                               // handle any errors

Was this information helpful? Send us your comments.