Retrieve an IT policy ID

To retrieve an IT policy ID, you can search for all IT policies using the findITPolicies() method and select the IT policy ID that you want. The findITPolicies() method returns IT policy objects, so you can return the IT policy objects instead of the IDs.
Before you begin: Retrieve the itPolicyName string for the name of the IT policy that you want to find.
  1. Create the integer to store the IT policy ID.
    int itPolicyID;
  2. Invoke findITPolicies().
    FindITPolicies request = new findITPolicies();
    request.locale = locale;
    request.includePolicyItems = false;
    FindITPoliciesResponse response = coreWebService.findITPolicies(request);
    FindITPoliciesResult result = response.returnValue;
  3. Check the result for errors and handle any errors
    if (result.getFindITPoliciesReturnStatus().getCode()!= FindITPoliciesReturnStatusEnumType.SUCCESS) 
    {
         // handle any errors
    }
  4. Loop through the result to find the IT policy that you want and store the ID.
    for (int i=0; i<result.itPolicies.Length; i++)
    {
        if (result.itPolicies[i].policyName.ToUpper().Equals(itPolicyName).ToUpper())
        {
             itPolicyID = result.itPolicies[i].policyId;
        }
    }
Previous topic: Managing policies

Was this information helpful? Send us your comments.