BlackBerry Administration API
v5.0.3.29

corews
Interface BAACore

Package class diagram package BAACore

public interface BAACore

Core web service that contains APIs for all platforms.


Method Summary
 AddGroupToGroupResult addGroupToGroup(int destinationGroupId, int groupId)
          Adds a group to a native group.
 AddUsersToGroupResult addUsersToGroup(int groupId, java.util.List<java.lang.Integer> userIds)
          Adds multiple users to a single group.
 AddUserToGroupResult addUserToGroup(int groupId, int userId)
          Adds a user to a group.
 AssignVPNConfigurationToUserResult assignVPNConfigurationToUser(int vpnBaseConfigSetId, int userId)
          Assigns a VPN configuration to a user.
 AssignWLANConfigurationToUserResult assignWLANConfigurationToUser(int wlanBaseConfigSetId, int userId)
          Assigns a WLAN configuration to a user.
 AttachITPolicyToGroupResult attachITPolicyToGroup(int groupId, int itpolicyId)
          Attaches an IT Policy to a group.
 AttachITPolicyToUserResult attachITPolicyToUser(int userId, int itpolicyId)
          Attaches an IT Policy to a user.
 AttachSoftwareConfigurationToGroupResult attachSoftwareConfigurationToGroup(int groupId, int swconfigId)
          Attaches a Software Configuration to a group.
 AttachSoftwareConfigurationToUserResult attachSoftwareConfigurationToUser(int userId, int swconfigId)
          Attaches a Software Configuration to a user.
 CancelKillHandheldResult cancelKillHandheld(int deviceId)
          Cancels a pending kill handheld command.
 CreateADAuthenticatedAdministratorUserResult createADAuthenticatedAdministratorUser(int organizationId, java.lang.String displayName, int roleId, java.lang.String username, java.lang.String domain)
          Creates an Active Directory authenticated administrator user.
 CreateBASAuthenticatedAdministratorUserResult createBASAuthenticatedAdministratorUser(int organizationId, java.lang.String displayName, int roleId, java.lang.String username, java.lang.String password)
          Creates a BAS authenticated administrator user.
 CreateGroupResult createGroup(int organizationId, java.lang.String locale, java.lang.String name, java.lang.String description)
          Creates a single native group.
 CreateUserResult createUser(UserEnableBlackBerryAttributes userEnableBlackBerryAttributes, java.lang.String locale, Group group, ITPolicy itpolicy, SoftwareConfiguration softwareConfiguration)
          Creates a single BlackBerry Enabled user.
 CreateUsersResult createUsers(java.util.List<UserEnableBlackBerryAttributes> userEnableBlackBerryAttributes, java.lang.String locale, Group group, ITPolicy itpolicy, SoftwareConfiguration softwareConfiguration)
          Creates multiple BlackBerry Enabled users.
 DeleteGroupResult deleteGroup(int groupId)
          Deletes the group specified by the group ID.
 DeleteUserResult deleteUser(int userId)
          Deletes a user specified by the user ID.
 DeleteUsersResult deleteUsers(java.util.List<java.lang.Integer> userIds)
          Deletes the users specified by their user Ids.
 DetachITPolicyFromGroupResult detachITPolicyFromGroup(int groupId, int itpolicyId)
          Detaches an IT Policy from a group.
 DetachITPolicyFromUserResult detachITPolicyFromUser(int userId, int itpolicyId)
          Detaches an IT Policy from a user.
 DetachSoftwareConfigurationFromGroupResult detachSoftwareConfigurationFromGroup(int groupId, int swconfigId)
          Detaches a Software Configuration from a group.
 DetachSoftwareConfigurationFromUserResult detachSoftwareConfigurationFromUser(int userId, int swconfigId)
          Detaches a Software Configuration from a user.
 DisableBlackBerryServiceForUserResult disableBlackBerryServiceForUser(int userId, boolean removeMailboxInfo)
          Disables BlackBerry service for a specified user.
 DisableBlackBerryServiceForUsersResult disableBlackBerryServiceForUsers(java.util.List<java.lang.Integer> userIds, boolean removeMailboxInfo)
          Disables BlackBerry service for multiple users.
 DisableBlackBerryUserAndDeleteUserResult disableBlackBerryUserAndDeleteUser(int userId, boolean removeMailboxInfo)
          Disables BlackBerry Service for a single user and deletes the user.
 FindCapabilityDefinitionsResult findCapabilityDefinitions(java.lang.String locale)
          Returns definitions for all capabilities.
 FindDeviceForUserResult findDeviceForUser(int userId, java.lang.String locale, boolean loadDeviceServiceAttributes)
          Returns a BlackBerry device of a given user.
 FindGroupsResult findGroups(int organizationId, java.lang.String locale)
          Returns all available groups in a given organization.
 FindITPoliciesResult findITPolicies(java.lang.String locale, boolean includePolicyItems)
          Returns all IT policies.
 FindITPoliciesForGroupResult findITPoliciesForGroup(int groupId)
          Returns all IT policies directly assigned to a group.
 FindITPoliciesForUserResult findITPoliciesForUser(int userId)
          Returns all IT policies directly assigned to a user.
 FindITPolicyTemplateItemsResult findITPolicyTemplateItems(java.lang.String locale, boolean includeUserDefinedTemplateItems)
          Returns all available IT Policy template items in the system.
 FindReconciledApplicationsForUserResult findReconciledApplicationsForUser(int userId, java.lang.String locale)
          Returns a list of reconciled applications of a user.
 FindResolvedUserCapabilitiesResult findResolvedUserCapabilities(int userId)
          Returns resolved capabilities for a user.
 FindRolesResult findRoles(int organizationId, java.lang.String locale)
          Returns roles for an organization and locale
 FindServerByHostNameResult findServerByHostName(java.lang.String hostName, java.lang.String locale)
          Returns a Server matching the given hostname.
 FindServiceInstancesByServerResult findServiceInstancesByServer(int serverId, java.lang.String locale, boolean includeStatus, boolean includeExtendedData, boolean loadServiceConsumerRelationships, boolean loadServiceProducerRelationships)
          Returns all service instances of a specified server.
 FindServiceInstancesByServiceResult findServiceInstancesByService(int serviceId, java.lang.String locale, boolean includeStatus, boolean includeExtendedData, boolean loadServiceConsumerRelationships, boolean loadServiceProducerRelationships)
          Returns all service instances of a specified service.
 FindServicesResult findServices(java.lang.String locale, boolean includeSettings)
          Returns all available services.
 FindSoftwareConfigurationApplicationsResult findSoftwareConfigurationApplications(ApplicationSearchCriteria searchCriteria, ApplicationSearchResultSortByEnum sortBy, boolean sortAscendingOrder, java.lang.String locale, SoftwareConfigurationApplicationData lastResultElement, int pageSize)
          finds available software configuration applications for a given search criteria.
 FindSoftwareConfigurationsResult findSoftwareConfigurations(java.lang.String locale, boolean includeApplicationsData, boolean includeOSConfiguration, boolean includeApplicationControlPolicyMetaData, boolean includeSoftwareConfigurationApplicationControlPolicyMetaData, int organizationId)
          Returns all software configurations in an organization.
 FindSoftwareConfigurationsForGroupResult findSoftwareConfigurationsForGroup(int groupId)
          Returns all Software Configurations directly assigned to a group.
 FindSoftwareConfigurationsForUserResult findSoftwareConfigurationsForUser(int userId)
          Returns all Software Configurations directly assigned to a user.
 FindUsersResult findUsers(UserSearchCriteria searchCriteria, BASEnumBaseDTO sortBy, boolean sortAscendingOrder, java.lang.String locale, UserSearchResult lastResultElement, int pageSize)
          Finds a user or a list of users for a given search criteria.
 FindVPNConfigurationsResult findVPNConfigurations(java.lang.String locale, boolean includePolicyItems)
          Returns all available VPN configurations.
 FindWLANConfigurationsResult findWLANConfigurations(java.lang.String locale, boolean includePolicyItems)
          Returns all available WLAN configurations.
 GetGroupResult getGroup(int groupId, java.lang.String locale, boolean loadGroupChildGroups, boolean loadGroupParentGroups, boolean loadGroupDirectUsers, boolean loadGroupDirectAssignments)
          Returns a group given a group ID.
 GetUserResult getUser(int userId, java.lang.String locale, boolean loadUserServiceAttributes, boolean loadUserDeviceConfigurationServiceAttributes, boolean loadUserResolvedGroups, boolean loadUserResolvedGroupIds, boolean loadUserGroups, boolean loadUserWLANVPNVOIPConfigurations)
          Returns a user given a user ID.
 IsKillHandheldPendingResult isKillHandheldPending(int deviceId)
          Determines if there is a pending kill handheld command for a BlackBerry device.
 KillHandheldResult killHandheld(int deviceId, int delayTime, boolean userOverride)
          Erases data on handheld and disables it.
 ManualFailoverResult manualFailover(int serviceInstanceId, java.util.List<ServiceInstanceRelationshipType> activeServiceConsumerRelationships, java.util.List<ServiceInstanceRelationshipType> passiveServiceConsumerRelationships)
          Manually failsover a service instance to another
 MoveUserResult moveUser(int userId, UserMoveBlackBerryAttributes userMoveBlackBerryAttributes)
          Moves a single BlackBerry Enabled user from one dispatcher instance to another.
 MoveUsersResult moveUsers(java.util.List<java.lang.Integer> userIds, UserMoveBlackBerryAttributes userMoveBlackBerryAttributes)
          Moves multiple BlackBerry Enabled users from one dispatcher instance to another.
 RemoveGroupFromGroupResult removeGroupFromGroup(int destinationGroupId, int groupId)
          Removes a group from a native group.
 RemoveUserFromGroupResult removeUserFromGroup(int groupId, int userId)
          Removes a user from a group.
 RemoveUsersFromGroupResult removeUsersFromGroup(int groupId, java.util.List<java.lang.Integer> userIds)
          Removes multiple users from a single group.
 ResendPeerToPeerKeyToUserResult resendPeerToPeerKeyToUser(int userId)
          Resends the peer-to-peer encryption key for a user.
 ResendPeerToPeerKeyToUsersResult resendPeerToPeerKeyToUsers(java.util.List<java.lang.Integer> userIds)
          Resends the peer-to-peer encryption key for multiple users.
 ResendReconciledApplicationsToUserResult resendReconciledApplicationsToUser(int userId, java.util.List<ReconciledApplication> reconciledApplications)
          Resends a list of reconciled applications to a user.
 ResendServiceBookToUserResult resendServiceBookToUser(int userId)
          Resends service book for a user.
 ResendServiceBookToUsersResult resendServiceBookToUsers(java.util.List<java.lang.Integer> userIds)
          Resends service books for multiple users.
 SendMessageToUserResult sendMessageToUser(int userId, UserMessage message, BASEnumBaseDTO messageTypeEnum)
          Sends a message to user.
 SendMessageToUsersResult sendMessageToUsers(java.util.List<java.lang.Integer> userIds, UserMessage message, BASEnumBaseDTO messageTypeEnum)
          Sends a message to multiple users.
 SetDeviceOwnerInfoResult setDeviceOwnerInfo(int deviceId, java.lang.String displayName, java.lang.String displayInfo)
          Sets the owner information on the device.
 SetDevicePasswordResult setDevicePassword(int deviceId, java.lang.String devicePassword)
          Sets the password for the specified device.
 SetGroupResult setGroup(Group group, java.lang.String locale)
          Updates a Group.
 SetUserResult setUser(User user, java.lang.String locale)
          Updates a User.
 java.lang.String test(java.lang.String input)
           
 UnassignVPNConfigurationFromUserResult unassignVPNConfigurationFromUser(int vpnBaseConfigSetId, int userId)
          Unassigns a VPN configuration from a user.
 UnassignWLANConfigurationFromUserResult unassignWLANConfigurationFromUser(int wlanBaseConfigSetId, int userId)
          Unassigns a WLAN configuration from a user.
 

Method Detail

disableBlackBerryServiceForUsers

DisableBlackBerryServiceForUsersResult disableBlackBerryServiceForUsers(java.util.List<java.lang.Integer> userIds,
                                                                        boolean removeMailboxInfo)
Disables BlackBerry service for multiple users. The users' mailbox information may be optionally removed.

Parameters:
userIds - the Ids of the users to disable BlackBerry service for
removeMailboxInfo - flag that indicates whether or not to remove the mailbox information (also known as 'force hard delete')
Since:
5.0.0
Sample:

Java CXF

boolean removeMailboxInfo = false;
DisableBlackBerryServiceForUsersResult disableBlackBerryServiceForUsersResult = coreWebService.disableBlackBerryServiceForUsers( userIds, removeMailboxInfo );
if( disableBlackBerryServiceForUsersResult.getDisableBlackBerryServiceForUsersReturnStatus().getCode() != DisableBlackBerryServiceForUserReturnStatusEnumType.SUCCESS ) {
   System.out.println( "One or more errors occurred while disabling users:" );
   List<DisableBlackBerryServiceForUsersReturnResult> returnResults = disableBlackBerryServiceForUsersResult.getDisableBlackBerryServiceForUsersReturnResult();
   for( int count = 0; count < returnResults.size(); count++ ) {
       DisableBlackBerryServiceForUserReturnStatus returnStatus = returnResults.get( count ).getDisableBlackBerryServiceForUserReturnStatus();
       if( returnStatus.getCode() != DisableBlackBerryServiceForUserReturnStatusEnumType.SUCCESS ) {
           System.out.println( "Error while disabling user ID " +
                   userIds.get(count).toString() + ": " +
                   returnStatus.getMessage() );
       }
   }
}
else {
    System.out.println( "Users disabled" );                                  
}
                               
Permissions Required:
User and device -> Edit a user

moveUsers

MoveUsersResult moveUsers(java.util.List<java.lang.Integer> userIds,
                          UserMoveBlackBerryAttributes userMoveBlackBerryAttributes)
Moves multiple BlackBerry Enabled users from one dispatcher instance to another.

Parameters:
userIds - the Ids of the users to move
userMoveBlackBerryAttributes - contains the destination service instance to move the users to
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
 
//find the service instance to move the user to, but first, we need to find the service, then the service instance
// set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
// type is DispatcherService
boolean includeSettings=true;
FindServicesResult servicesResult= coreWebService.findServices(locale, includeSettings);
if (servicesResult.getFindServicesReturnStatus().getCode()!= FindServicesReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + servicesResult.getFindServicesReturnStatus().getMessage());
    return;
}

ServiceType dispatcherService=null;
for (ServiceType itr2:servicesResult.getServices()) {
    if (itr2 instanceof DispatcherService) {
        dispatcherService=itr2;
        break;
    }
}
 
if (dispatcherService==null) {
    System.out.println("Dispatcher Service not found");
    return;
}
 
// find the dispatcher instance on the server. this is needed for the serviceInstance
// and targetserviceInstance fields of the userMoveBlackBerryAttributes object
boolean includeStatus=false;
// this flag has to be set to true, or else none of the plug-in data will be loaded.
// this is needed in order to find the Dispatcher service instance
boolean includeExtendedData=true;
boolean loadServiceConsumerRelationships=false;
boolean loadServiceProducerRelationships=false;
FindServiceInstancesByServiceResult serviceInstanceResult= coreWebService.findServiceInstancesByService(dispatcherService.getServiceId(), locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
if (serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getCode()!= FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getMessage());
    return;
}
 
List<ServiceInstanceType> serviceInstances=serviceInstanceResult.getServiceInstances();
ServiceInstanceType targetDispatcherInstance=null;
for (ServiceInstanceType itr2:serviceInstances) {
    //find the Dispatcher instance by determining the type of the instance
    // the type should be DispatcherHostServiceInstance
    if (itr2 instanceof DispatcherHostServiceInstance) {
        //check to see if it is the dispatcher service instance you want by looking at the name
        if (itr2.getName().equalsIgnoreCase("server01")) {
            targetDispatcherInstance=itr2;
            break;
        }
    }
}
 
if (targetDispatcherInstance==null) {
    System.out.println("DispatcherHostInstance not found");
}
//create userMoveBlackBerryAttributes object needed for the createUser API.
UserMoveBlackBerryAttributes userMoveBBAttributes=new UserMoveBlackBerryAttributes();
 
//set the serviceInstance
userMoveBBAttributes.setServiceInstance(targetDispatcherInstance);
userMoveBBAttributes.setTargetServiceInstance(targetDispatcherInstance);
 
userMoveBBAttributes.setIgnoreDuplicateWarning(false);
userMoveBBAttributes.setIgnoreEncryptionWarning(false);
userMoveBBAttributes.setIgnoreInactiveTargetWarnings(false);
userMoveBBAttributes.setFailOutstandingJobs(false);
 
//call move users
MoveUserResult moveUsersResult= coreWebService.moveUsers(userIds, userMoveBBAttributes);
if (moveUsersResult.getMoveUsersReturnStatus().getCode()!=MoveUserReturnStatusEnumType.SUCCESS) {
    System.out.println(moveUsersResult.getMoveUserReturnStatus().getMessage());
    for (MoveUsersReturnResult itr:moveUsersResult.getMoveUsersReturnResult()) {
        System.out.println("message: " + itr.getMoveUserReturnStatus().getMessage());
    }
}

               
Permissions Required:
User and device -> Edit a user

findRoles

FindRolesResult findRoles(int organizationId,
                          java.lang.String locale)
Returns roles for an organization and locale

Parameters:
organizationId - the Id of the organization. Use 0 for default.
locale - the locale of the returned roles
Returns:
Roles
Since:
5.0.2
Sample:

Java CXF

int organizationId=0;
String locale="en_US";

FindRolesResult result= coreWebService.findRoles(organizationId,locale);
if (result.getFindRolesReturnStatus().getCode()!= FindRolesReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindRolesReturnStatus().getMessage());
    return;
}

for (Role itr:result.getRoles()) {
    System.out.println("RoleId: " + itr.getRoleId());
    System.out.println("Name: " + itr.getLocaleNameAndDescription().get(0).getName());
}

         
Permissions Required:
BlackBerry Administration Service setup -> View a role

unassignWLANConfigurationFromUser

UnassignWLANConfigurationFromUserResult unassignWLANConfigurationFromUser(int wlanBaseConfigSetId,
                                                                          int userId)
Unassigns a WLAN configuration from a user.

Parameters:
wlanBaseConfigSetId - the WLAN configuration set ID to unassign
userId - the ID of the user to detach
Since:
5.0.0
Sample:

Java CXF

int userId=super.getValidUserID();
String locale="en_US";
boolean loadUserServiceAttributes=false;
boolean loadUserDeviceConfigurationServiceAttributes=false;
boolean loadUserResolvedGroups=false;
boolean loadUserResolvedGroupIds=false;
boolean loadUserGroups=false;
boolean loadUserWLANVPNVOIPConfigurations=true;
GetUserResult result= coreWebService.getUser(userId, locale, loadUserServiceAttributes, loadUserDeviceConfigurationServiceAttributes, loadUserResolvedGroups, loadUserResolvedGroupIds, loadUserGroups, loadUserWLANVPNVOIPConfigurations);
 
if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getGetUserReturnStatus().getMessage());
       return;
}
 
User user=result.getUser();
 
for (ITPolicyWLANVPNVOIPAttributes itr:user.getITPolicyWLANVPNVOIPAttributes()) {
       //detach the first WLAN configuration from the user
       for (WLANConfigurations itr2:itr.getWLANConfigurations()) {
               System.out.println("Detaching WLAN config:" + itr2.getPolicyName());
               int WLANConfigId=itr2.getWLANBaseConfigSetsId();
               UnassignWLANConfigurationFromUserResult detachResult= coreWebService.unassignWLANConfigurationFromUser(WLANConfigId, userId);
               if (detachResult.getUnassignWLANConfigurationFromUserReturnStatus().getCode() != UnassignWLANConfigurationFromUserReturnStatusEnumType.SUCCESS) {
                       System.out.println("Error occurred: " + detachResult.getUnassignWLANConfigurationFromUserReturnStatus().getMessage());
                       return;
               }
               break;
       }
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

findServices

FindServicesResult findServices(java.lang.String locale,
                                boolean includeSettings)
Returns all available services. The data in the returned ServiceType object is presented. in the specified locale.

Parameters:
locale - the ServiceType object returned will contain data in this locale
includeSettings - if set to true, all plug-in related fields of the ServiceType object will be set
Returns:
ServiceType objects representing all services
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
// set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
// type of the Service. i.e. DispatcherService
boolean includeSettings=true;
FindServicesResult servicesResult=coreWebService.findServices(locale, includeSettings);
if (servicesResult.getFindServicesReturnStatus().getCode()!= FindServicesReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + servicesResult.getFindServicesReturnStatus().getMessage());
}
  
for (ServiceType itr:servicesResult.getServices()) {
    if (itr instanceof DispatcherService) {
        System.out.println("Dispatcher Service ID:" + itr.getServiceId());
    }
}

                               
Permissions Required:
Topology -> View a Component

deleteGroup

DeleteGroupResult deleteGroup(int groupId)
Deletes the group specified by the group ID.

Parameters:
groupId - the ID of the group to delete
Since:
5.0.0
Sample:

Java CXF

DeleteGroupResult deleteGroupResult = coreWebService.deleteGroup( groupId );
if( deleteGroupResult.getDeleteGroupReturnStatus().getCode() != DeleteGroupReturnStatusEnumType.SUCCESS ) {
     System.out.println( "Error occurred while deleting group: " + deleteGroupResult.getDeleteGroupReturnStatus().getMessage() );
}
else {
     System.out.println( "Group deleted: groupId=" + groupId );
}                                        
                               
Permissions Required:
User and device -> Delete a group

assignVPNConfigurationToUser

AssignVPNConfigurationToUserResult assignVPNConfigurationToUser(int vpnBaseConfigSetId,
                                                                int userId)
Assigns a VPN configuration to a user.

Parameters:
vpnBaseConfigSetId - the VPN configuration set ID to assign
userId - the ID of the user to attach
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
//get the VPN configuration
boolean includePolicyItems=true;
FindVPNConfigurationsResult VPNConfigurationsResult= coreWebService.findVPNConfigurations(locale, includePolicyItems);
if (VPNConfigurationsResult.getFindVPNConfigurationsReturnStatus().getCode()!= FindVPNConfigurationsReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + VPNConfigurationsResult.getFindVPNConfigurationsReturnStatus().getMessage());
       return;
}
 
if (VPNConfigurationsResult.getITPolicies().size()>0) {
       //assign the first available VPN configuration to the user
       int VPNConfigId=VPNConfigurationsResult.getITPolicies().get(0).getPolicyId();
       AssignVPNConfigurationToUserResult result= coreWebService.assignVPNConfigurationToUser(VPNConfigId, userId);
       if (result.getAssignVPNConfigurationToUserReturnStatus().getCode() != AssignVPNConfigurationToUserReturnStatusEnumType.SUCCESS) {
               System.out.println("Error occurred: " + result.getAssignVPNConfigurationToUserReturnStatus().getMessage());
       }
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

isKillHandheldPending

IsKillHandheldPendingResult isKillHandheldPending(int deviceId)
Determines if there is a pending kill handheld command for a BlackBerry device.

Parameters:
deviceId - the ID of the device to check
Returns:
true if there is a pending kill handheld command, false otherwise
Since:
5.0.0
Sample:

Java CXF

IsKillHandheldPendingResult isKillHandheldPendingResult=coreWebService.isKillHandheldPending(deviceId);
if (isKillHandheldPendingResult.getIsKillHandheldPendingReturnStatus().getCode() != IsKillHandheldPendingReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + isKillHandheldPendingResult.getIsKillHandheldPendingReturnStatus().getMessage());
    return;
}
 
System.out.println("Kill Handheld Pending:" + isKillHandheldPendingResult.isKillHandheldPending());

               
Permissions Required:
Device owner OR Organizations -> View a device across organizations OR User and device -> View a device

addUserToGroup

AddUserToGroupResult addUserToGroup(int groupId,
                                    int userId)
Adds a user to a group.

Parameters:
groupId - the ID of the group to add user to
userId - the ID of the user to add
Since:
5.0.0
Sample:

Java CXF

AddUserToGroupResult result=coreWebService.addUserToGroup(groupId,userId);
if (result.getAddUserToGroupReturnStatus().getCode()!= AddUserToGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getAddUserToGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Edit a user
User and device -> Edit a group OR Organizations -> Edit a group across organizations

manualFailover

ManualFailoverResult manualFailover(int serviceInstanceId,
                                    java.util.List<ServiceInstanceRelationshipType> activeServiceConsumerRelationships,
                                    java.util.List<ServiceInstanceRelationshipType> passiveServiceConsumerRelationships)
Manually failsover a service instance to another

Parameters:
serviceInstanceId - the id of the host service instance. Use the findServiceInstancesByService API to retrieve the id of the host service instance.
activeServiceConsumerRelationships - the service consumer relationships to failover from
passiveServiceConsumerRelationships - the service consumer relationships to failover to
Since:
5.0.1
Sample:

Java CXF

// To do failover of the BlackBerry Enterprise Server, 4 steps are required
// 1. find the Dispatcher service id
// 2. find the correct Host Dispatcher Service Instances. i.e. find the appropriate pool of the BlackBerry Enterprise Server
// 3. find the active and passive instances
// 4. perform failover
 
///////////////////////////////////////////
// Step 1 - find the Dispatcher Service
///////////////////////////////////////////
 
// set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
// type of the Service. i.e. DispatcherService
boolean includeSettings=true;
FindServicesResult servicesResult= coreWebService.findServices(locale, includeSettings);
if (servicesResult.getFindServicesReturnStatus().getCode()!= FindServicesReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + servicesResult.getFindServicesReturnStatus().getMessage());
       return;
}
 
int dispatcherServiceId=-1;
 
for (ServiceType itr:servicesResult.getServices()) {
       if (itr instanceof DispatcherService) {
               dispatcherServiceId=itr.getServiceId();
               break;
       }
}
 
if (dispatcherServiceId==-1) {
       System.out.println("Cannot find dispatcher service");
       return;
}
 
 
///////////////////////////////////////////
// Step 2 - find the correct Host Dispatcher Service Instances. i.e. find the appropriate pool of the BlackBerry Enterprise Server
///////////////////////////////////////////
boolean includeStatus=true;
boolean includeExtendedData=true;
boolean loadServiceConsumerRelationships=true;
boolean loadServiceProducerRelationships=false;
 
FindServiceInstancesByServiceResult result= coreWebService.findServiceInstancesByService(dispatcherServiceId, locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
 
if (result.getFindServiceInstancesByServiceReturnStatus().getCode()!= FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getFindServiceInstancesByServiceReturnStatus().getMessage());
       return;
}
 
String dispatcherPoolName="SERVER1";
DispatcherHostServiceInstance dispatcherHostServiceInstance=null;
List<ServiceInstanceType> serviceInstances=result.getServiceInstances();
for (ServiceInstanceType itr:serviceInstances) {
       if (itr instanceof DispatcherHostServiceInstance && itr.getName().equalsIgnoreCase(dispatcherPoolName)) {
               dispatcherHostServiceInstance=(DispatcherHostServiceInstance)itr;
               break;
       }
}
 
if (dispatcherHostServiceInstance==null) {
       System.out.println("Cannot find dispatcher host service instance with name " + dispatcherPoolName);
       return;
}
 
 
///////////////////////////////////////////
// Step 3 - find the active and passive instances based on MachineName
///////////////////////////////////////////
String activeMachineName="SERVER1";
String passiveMachineName="SERVER2";
ServiceInstanceRelationshipType currentActiveRelationship=null;
ServiceInstanceRelationshipType currentPassiveRelationship=null;
for (ServiceInstanceRelationshipType itr:dispatcherHostServiceInstance.getServiceConsumers()) {
       if (itr.getInstalledMachine().getHostName().equalsIgnoreCase(activeMachineName)) {
          currentActiveRelationship=itr;
       } else if (itr.getInstalledMachine().getHostName().equalsIgnoreCase(passiveMachineName)) {
          currentPassiveRelationship=itr;
       }
}
 
if (currentActiveRelationship==null) {
       System.out.println("Cannot find the active service instance on host " + activeMachineName);
       return;
}
 
if (currentPassiveRelationship==null) {
       System.out.println("Cannot find the passive service instance on host " + passiveMachineName);
       return;
}
  
 
///////////////////////////////////////////
// Step 4 - perform failover
///////////////////////////////////////////
ArrayList<ServiceInstanceRelationshipType> failoverFrom=new ArrayList<ServiceInstanceRelationshipType>();
failoverFrom.add(currentActiveRelationship);
ArrayList<ServiceInstanceRelationshipType> failoverTo=new ArrayList<ServiceInstanceRelationshipType>();
failoverTo.add(currentPassiveRelationship);
 
ManualFailoverResult manualFailoverResult= coreWebService.manualFailover(dispatcherHostServiceInstance.getServiceInstanceId(), failoverFrom, failoverTo);
if (manualFailoverResult.getManualFailoverReturnStatus().getCode()!= ManualFailoverReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + manualFailoverResult.getManualFailoverReturnStatus().getMessage());
       return;
}

                               
Permissions Required:
Topology -> Edit an instance relationship

detachITPolicyFromGroup

DetachITPolicyFromGroupResult detachITPolicyFromGroup(int groupId,
                                                      int itpolicyId)
Detaches an IT Policy from a group.

Parameters:
groupId - the ID of the group to detach
itpolicyId - the ID of the IT Policy to detach group from
Since:
5.0.0
Sample:

Java CXF

DetachITPolicyFromGroupResult result=coreWebService.detachITPolicyFromGroup(groupId,itpolicyId);
if (result.getDetachITPolicyFromGroupReturnStatus().getCode()!= DetachITPolicyFromGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getDetachITPolicyFromGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

detachSoftwareConfigurationFromUser

DetachSoftwareConfigurationFromUserResult detachSoftwareConfigurationFromUser(int userId,
                                                                              int swconfigId)
Detaches a Software Configuration from a user.

Parameters:
userId - the ID of the user to detach
swconfigId - the ID of the software configuration to detach user from
Since:
5.0.0
Sample:

Java CXF

DetachSoftwareConfigurationFromUserResult result=coreWebService.detachSoftwareConfigurationFromUser(userId,swconfigId);
if (result.getDetachSoftwareConfigurationFromUserReturnStatus().getCode()!= DetachSoftwareConfigurationFromUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getDetachSoftwareConfigurationFromUserReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

attachSoftwareConfigurationToUser

AttachSoftwareConfigurationToUserResult attachSoftwareConfigurationToUser(int userId,
                                                                          int swconfigId)
Attaches a Software Configuration to a user.

Parameters:
userId - the ID of the user to attach
swconfigId - the ID of the software configuration to attach user to
Since:
5.0.0
Sample:

Java CXF

AttachSoftwareConfigurationToUserResult result=coreWebService.attachSoftwareConfigurationToUser(userId,swconfigId);
if (result.getAttachSoftwareConfigurationToUserReturnStatus().getCode()!= AttachSoftwareConfigurationToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getAttachSoftwareConfigurationToUserReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

detachITPolicyFromUser

DetachITPolicyFromUserResult detachITPolicyFromUser(int userId,
                                                    int itpolicyId)
Detaches an IT Policy from a user.

Parameters:
userId - the ID of the user to detach
itpolicyId - the ID of the IT Policy to detach user from
Since:
5.0.0
Sample:

Java CXF

DetachITPolicyFromUserResult result=coreWebService.detachITPolicyFromUser(userId,itpolicyId);
if (result.getDetachITPolicyFromUserReturnStatus().getCode()!= DetachITPolicyFromUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getDetachITPolicyFromUserReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

findITPoliciesForGroup

FindITPoliciesForGroupResult findITPoliciesForGroup(int groupId)
Returns all IT policies directly assigned to a group.

Parameters:
groupId - the ID of the group
Returns:
ITPolicyIds IDs of the IT Policies assigned to the group
Since:
5.0.0
Sample:

Java CXF

FindITPoliciesForGroupResult result= coreWebService.findITPoliciesForGroup(groupId);
if (result.getFindITPoliciesForGroupReturnStatus().getCode()!= FindITPoliciesForGroupReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getFindITPoliciesForGroupReturnStatus().getMessage());
       return;
}
 
for (int itr:result.getITPolicyIds()) {
       System.out.println("Id: " + itr);
}

                               
Permissions Required:
User and device -> View an IT policy
User and device -> View a group OR Organizations -> View a group across organizations

disableBlackBerryServiceForUser

DisableBlackBerryServiceForUserResult disableBlackBerryServiceForUser(int userId,
                                                                      boolean removeMailboxInfo)
Disables BlackBerry service for a specified user. The user's mailbox information may be optionally removed.

Parameters:
userId - the ID of the user to disable BlackBerry service for
removeMailboxInfo - flag that indicates whether or not to remove the mailbox information (also known as 'force hard delete')
Since:
5.0.0
Sample:

Java CXF

boolean removeMailboxInfo=false;
DisableBlackBerryServiceForUserResult result = coreWebService.disableBlackBerryServiceForUser(userId,removeMailboxInfo);
if (result.getDisableBlackBerryServiceForUserReturnStatus().getCode()!= DisableBlackBerryServiceForUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getDisableBlackBerryServiceForUserReturnStatus().getMessage());
}
 

                               
Permissions Required:
User and device -> Edit a user

sendMessageToUsers

SendMessageToUsersResult sendMessageToUsers(java.util.List<java.lang.Integer> userIds,
                                            UserMessage message,
                                            BASEnumBaseDTO messageTypeEnum)
Sends a message to multiple users.

Parameters:
userIds - the Ids of the users to send message to
message - the message containing subject and body to send to the users
messageTypeEnum - the message type. i.e. email, PIN, etc. Use enums named *MessageTypeEnum such as DispatcherMessageTypeEnum, EmailCommonMessageTypeEnum
Since:
5.0.0
Sample:

Java CXF

UserMessage message=new UserMessage();
DispatcherMessageTypeEnum messageType=new DispatcherMessageTypeEnum();
messageType.setEnum(DispatcherMessageTypeEnumType.PIN);
message.setSubject("subject");
message.setBody("message body");
SendMessageToUsersResult result=coreWebService.sendMessageToUsers(userIds, message, messageType);
 
if (result.getSendMessageToUsersReturnStatus().getCode()!= SendMessageToUserReturnStatusEnumType.SUCCESS) {
    System.out.println(result.getSendMessageToUsersReturnStatus().getMessage());
}
 
for (SendMessageToUsersReturnResult itr:result.getSendMessageToUsersReturnResult()) {
    System.out.println("code: " + itr.getSendMessageToUserReturnStatus().getCode().value());
    System.out.println("message: " + itr.getSendMessageToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR BlackBerry Administration Service setup -> Send message

findServerByHostName

FindServerByHostNameResult findServerByHostName(java.lang.String hostName,
                                                java.lang.String locale)
Returns a Server matching the given hostname. The data in the returned Server object is presented in the specified locale.

Parameters:
hostName - DNS name of the server
locale - the Server object returned will contain data in this locale
Returns:
Server object matching the given hostname.
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
 
//call findServerByHostName
FindServerByHostNameResult result=coreWebService.findServerByHostName("server01", locale);
 
//check error code
if (result.getFindServerByHostNameReturnStatus().getCode()!= FindServerByHostNameReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindServerByHostNameReturnStatus().getMessage());
}
 
//get the server object and print some information about it
Server server=result.getServer();
System.out.println(server.getServerId() + ", " + server.getHostName());

                               
Permissions Required:
Topology -> View a Server

setDeviceOwnerInfo

SetDeviceOwnerInfoResult setDeviceOwnerInfo(int deviceId,
                                            java.lang.String displayName,
                                            java.lang.String displayInfo)
Sets the owner information on the device.

Parameters:
deviceId - the ID of the device on which to set owner information
displayName - the name to be displayed on the device
displayInfo - the additional information to be displayed on the device
Since:
5.0.0
Sample:

Java CXF

int deviceId=device.getDeviceId();
String displayName = "Clyde Warren";
String displayInfo = "Info";
SetDeviceOwnerInfoResult setDeviceOwnerInfoResult=coreWebService.setDeviceOwnerInfo(deviceId, displayName, displayInfo);
if (setDeviceOwnerInfoResult.getSetDeviceOwnerInfoReturnStatus().getCode() != SetDeviceOwnerInfoReturnStatusEnumType.SUCCESS) {
   System.out.println("Error occurred: " + setDeviceOwnerInfoResult.getSetDeviceOwnerInfoReturnStatus().getMessage());
}

                               
Permissions Required:
Device owner OR Organizations -> Edit a device across organizations OR User and device -> Edit a device

findITPoliciesForUser

FindITPoliciesForUserResult findITPoliciesForUser(int userId)
Returns all IT policies directly assigned to a user.

Parameters:
userId - the ID of the user
Returns:
ITPolicyIds IDs of the IT Policies assigned to the user
Since:
5.0.0
Sample:

Java CXF

FindITPoliciesForUserResult result= coreWebService.findITPoliciesForUser(userId);
if (result.getFindITPoliciesForUserReturnStatus().getCode()!= FindITPoliciesForUserReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getFindITPoliciesForUserReturnStatus().getMessage());
       return;
}
 
for (int itr:result.getITPolicyIds()) {
       System.out.println("Id: " + itr);
}

                               
Permissions Required:
Current user OR User and device -> View a user AND User and device -> View an IT policy

resendServiceBookToUsers

ResendServiceBookToUsersResult resendServiceBookToUsers(java.util.List<java.lang.Integer> userIds)
Resends service books for multiple users.

Parameters:
userIds - the Ids of the users to resend servicebooks
Since:
5.0.0
Sample:

Java CXF

ResendServiceBookToUsersResult result= coreWebService.resendServiceBookToUsers(userIds);
 
if (result.getResendServiceBookToUsersReturnStatus().getCode()!= ResendServiceBookToUserReturnStatusEnumType.SUCCESS) {
    System.out.println(result.getResendServiceBookToUsersReturnStatus().getMessage());
}
 
for (ResendServiceBookToUsersReturnResult itr:result.getResendServiceBookToUsersReturnResult()) {
    System.out.println("code: " + itr.getResendServiceBookToUserReturnStatus().getCode().value());
    System.out.println("message: " + itr.getResendServiceBookToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR Resend data to devices

createUsers

CreateUsersResult createUsers(java.util.List<UserEnableBlackBerryAttributes> userEnableBlackBerryAttributes,
                              java.lang.String locale,
                              Group group,
                              ITPolicy itpolicy,
                              SoftwareConfiguration softwareConfiguration)
Creates multiple BlackBerry Enabled users.

Parameters:
userEnableBlackBerryAttributes - describe the users to be added by populating this object
locale - the locale used when setting userEnabledBlackBerryAttributes
group - the group to attach users to. use null if no group attachment is needed.
itpolicy - the IT Policy to attach to the users. use null if no IT Policy attachment is needed.
softwareConfiguration - the software configuration to attach to the users. use null if no software configuration attachment is needed
Returns:
the user ID of the newly created user
Since:
5.0.0
Sample:

Java CXF

//create search criteria
MailStoreUserSearchCriteria criteria=new MailStoreUserSearchCriteria();
 
//search by DisplayName
criteria.setDisplayName("Clyde Warren");
 
//create sort by enum
MailStoreUserSearchResultSortByEnum sortByEnum=new MailStoreUserSearchResultSortByEnum();
sortByEnum.setEnum(MailStoreUserSearchResultSortByEnumType.DISPLAY_NAME);
 
int pageSize=100;
String locale="en_US";
 
FindMailStoreUsersResult result=emailExchangeWebService.findMailStoreUsers(criteria, sortByEnum, true, locale, null, pageSize);
 
//list that holds all users to be added
List <UserEnableBlackBerryAttributes>; toAddList=new ArrayList<UserEnableBlackBerryAttributes>();
 
//find the service instance to add the user to, but first, we need to find the service, then the service instance
// set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
// type is DispatcherService
boolean includeSettings=true;
FindServicesResult servicesResult=coreWebService.findServices(locale, includeSettings);
if (servicesResult.getFindServicesReturnStatus().getCode()!= FindServicesReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + servicesResult.getFindServicesReturnStatus().getMessage());
}
 
ServiceType dispatcherService=null;
for (ServiceType itr2:servicesResult.getServices()) {
    if (itr2 instanceof DispatcherService) {
        dispatcherService=itr2;
        break;
    }
}
 
if (dispatcherService==null) {
    System.out.println("Dispatcher Service not found");
}
 
// find the dispatcher instance on the server. this is what is needed for the serviceInstance
// and targetserviceInstance fields of the UserEnableBlackBerryAttributes object
boolean includeStatus=false;
// this flag has to be set to true, or else none of the plug-in data will be loaded.
// this is needed in order to find the Dispatcher service instance
boolean includeExtendedData=true;
boolean loadServiceConsumerRelationships=false;
boolean loadServiceProducerRelationships=false;
FindServiceInstancesByServiceResult serviceInstanceResult=coreWebService.findServiceInstancesByService(dispatcherService.getServiceId(), locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
if (serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getCode()!= FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getMessage());
}
 
List<ServiceInstanceType> serviceInstances=serviceInstanceResult.getServiceInstances();
ServiceInstanceType targetDispatcherInstance=null;
for (ServiceInstanceType itr2:serviceInstances) {
 
    //find the Dispatcher instance by determining the type of the instance
    // the type should be DispatcherHostServiceInstance
    if (itr2 instanceof DispatcherHostServiceInstance) {
        //check to see if it is the dispatcher service instance you want by looking at the name
        if (itr2.getName().equalsIgnoreCase("server01")) {
            targetDispatcherInstance=itr2;
            break;
        }
    }
}
 
//call create User API
if (targetDispatcherInstance==null) {
    System.out.println("DispatcherHostInstance not found");
}
 
//loop through pages and create all users found matching the criteria
while (result.getFindMailStoreUsersReturnStatus().getCode() == FindMailStoreUsersReturnStatusEnumType.SUCCESS && result.getMailStoreUserSearchResult()!=null) {
    for (MailStoreUserSearchResult itr: result.getMailStoreUserSearchResult()) {
 
        //get the attributes needed in order to create a user by passing in the MailStoreUserSearchResult
        GatherEnableBlackBerryUserAttributesResult attributes=emailExchangeWebService.gatherEnableBlackBerryUserAttributes(itr, locale);
 
        //create UserEnableBlackBerryAttributes object needed for the createUser API.
        UserEnableBlackBerryAttributes userEnableBBAttributes=new UserEnableBlackBerryAttributes();
 
        //add all attributes found from the gatherEnableBlackBerryUserAttributes API
        // to the UserEnableBlackBerryAttributes object
        for (EnableBlackBerryUserAttributesType itr2:attributes.getEnableBlackBerryUserAttributes()) {
            userEnableBBAttributes.getEnableBlackBerryUserAttributes().add(itr2);
        }
 
        //set the serviceInstance
        userEnableBBAttributes.setServiceInstance(targetDispatcherInstance);
        //set the targetServiceInstance. this is the same as the service instance.
        //if moving a user, the targetServiceInstance would be different.
        userEnableBBAttributes.setTargetServiceInstance(targetDispatcherInstance);
 
        userEnableBBAttributes.setIgnoreDuplicateWarning(false);
        userEnableBBAttributes.setIgnoreEncryptionWarning(false);
        userEnableBBAttributes.setIgnoreInactiveTargetWarnings(false);
        userEnableBBAttributes.setFailOutstandingJobs(false);
        //set to default organization id
        userEnableBBAttributes.setOrganizationId(0);
 
        //add to the list of users to be created
        toAddList.add(userEnableBBAttributes);
    }
 
    result=emailExchangeWebService.findMailStoreUsers(criteria, sortByEnum, true, locale, result.getMailStoreUserSearchResult().get(result.getMailStoreUserSearchResult().size()-1), pageSize);
}
 
if (result.getFindMailStoreUsersReturnStatus().getCode() != FindMailStoreUsersReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindMailStoreUsersReturnStatus().getMessage());
}
 
//get a list of groups
FindGroupsResult findGroupsResult=coreWebService.findGroups(0, locale);
if (findGroupsResult.getFindGroupsReturnStatus().getCode()!=FindGroupsReturnStatusEnumType.SUCCESS) {
    System.out.println("Group not found");
}
 
//get the first group
Group targetGroup=null;
if (findGroupsResult.getGroups().size()>0) {
    targetGroup=findGroupsResult.getGroups().get(0);
}
 
//get a list of it policies
boolean includePolicyItems=false;
FindITPoliciesResult findITPoliciesResult=coreWebService.findITPolicies(locale, includePolicyItems);
if (findITPoliciesResult.getFindITPoliciesReturnStatus().getCode()!=FindITPoliciesReturnStatusEnumType.SUCCESS) {
    System.out.println("IT Policies not found");
    return;
}
 
//get the first IT Policy
ITPolicy targetITPolicy=null;
if (findITPoliciesResult.getITPolicies().size()>0) {
    targetITPolicy=findITPoliciesResult.getITPolicies().get(0);
}
 
//get a list of software configurations
boolean includeApplicationsData=false;
boolean includeOSConfiguration=false;
boolean includeApplicationControlPolicyMetaData=false;
boolean includeSoftwareConfigurationApplicationControlPolicyMetaData=false;
int organizationId=0;
FindSoftwareConfigurationsResult findSoftwareConfigurationResult=coreWebService.findSoftwareConfigurations(locale,includeApplicationsData,includeOSConfiguration,includeApplicationControlPolicyMetaData, includeSoftwareConfigurationApplicationControlPolicyMetaData, organizationId);
if (findSoftwareConfigurationResult.getFindSoftwareConfigurationsReturnStatus().getCode()!= FindSoftwareConfigurationsReturnStatusEnumType.SUCCESS) {
    System.out.println("Software Configuration not found");
    return;
}

//get the first software configuration
SoftwareConfiguration targetSoftwareConfiguration=null;
if (findSoftwareConfigurationResult.getSoftwareConfigurations().size()>0) {
    targetSoftwareConfiguration=findSoftwareConfigurationResult.getSoftwareConfigurations().get(0);
}
 
//call create user
CreateUsersResult createUsersResult=coreWebService.createUsers(toAddList, locale, targetGroup, targetITPolicy, targetSoftwareConfiguration);
if (createUsersResult.getCreateUsersReturnStatus().getCode()!=CreateUserReturnStatusEnumType.SUCCESS) {
    System.out.println(createUsersResult.getCreateUsersReturnStatus().getMessage());
}
 
for (CreateUsersReturnResult itr:createUsersResult.getCreateUsersReturnResult()) {
    System.out.println("User ID=" + itr.getUserId());
    System.out.println("message: " + itr.getCreateUserReturnStatus().getMessage());
}

                               
Permissions Required:
User and device -> Create a user
User and device -> Add or remove to user configuration
User and device -> Edit a user
User and device -> Edit a group OR Organizations -> Edit a group across organizations

attachITPolicyToUser

AttachITPolicyToUserResult attachITPolicyToUser(int userId,
                                                int itpolicyId)
Attaches an IT Policy to a user.

Parameters:
userId - the ID of the user to attach
itpolicyId - the ID of the IT Policy to attach user to
Since:
5.0.0
Sample:

Java CXF

AttachITPolicyToUserResult result=coreWebService.attachITPolicyToUser(userId,itpolicyId);
if (result.getAttachITPolicyToUserReturnStatus().getCode()!= AttachITPolicyToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getAttachITPolicyToUserReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

resendPeerToPeerKeyToUsers

ResendPeerToPeerKeyToUsersResult resendPeerToPeerKeyToUsers(java.util.List<java.lang.Integer> userIds)
Resends the peer-to-peer encryption key for multiple users.

Parameters:
userIds - the Ids of the users to resend the peer-to-peer encryption key
Since:
5.0.0
Sample:

Java CXF

ResendPeerToPeerKeyToUsersResult result= coreWebService.resendPeerToPeerKeyToUsers(userIds);
 
if (result.getResendPeerToPeerKeyToUsersReturnStatus().getCode()!= ResendPeerToPeerKeyToUserReturnStatusEnumType.SUCCESS) {
    System.out.println(result.getResendPeerToPeerKeyToUsersReturnStatus().getMessage());
}

for (ResendPeerToPeerKeyToUsersReturnResult itr:result.getResendPeerToPeerKeyToUsersReturnResult()) {
    System.out.println("code: " + itr.getResendPeerToPeerKeyToUserReturnStatus().getCode().value());
    System.out.println("message: " + itr.getResendPeerToPeerKeyToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR Resend data to devices

findReconciledApplicationsForUser

FindReconciledApplicationsForUserResult findReconciledApplicationsForUser(int userId,
                                                                          java.lang.String locale)
Returns a list of reconciled applications of a user.

Parameters:
userId - the userId to look for
locale - the locale of the returned data
Returns:
User object containing details about the user
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
 
FindReconciledApplicationsForUserResult result=coreWebService.findReconciledApplicationsForUser(userId, locale);
 
if (result.getFindReconciledApplicationsForUserReturnStatus().getCode() != FindReconciledApplicationsForUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindReconciledApplicationsForUserReturnStatus().getMessage());
    return;
}
 
List<ReconciledApplication> reconciledApplications=result.getReconciledApplications();
for (ReconciledApplication itr:reconciledApplications) {
    System.out.println("Application Delivery Mode: " + itr.getObjectDeliveryModeType().value());
    System.out.println("Application Name: " + itr.getApplicationLocaleNameAndDescription().get(0).getName());
    System.out.println("Application Version: " + itr.getApplicationVersion());
}
                               
Permissions Required:
Current user OR User and device -> View a user

deleteUser

DeleteUserResult deleteUser(int userId)
Deletes a user specified by the user ID.

Parameters:
userId - the ID of the user to delete
Since:
5.0.0
Sample:

Java CXF

DeleteUserResult deleteUserResult = coreWebService.deleteUser( userId );
if( deleteUserResult.getDeleteUserReturnStatus().getCode() != DeleteUserReturnStatusEnumType.SUCCESS ) {
    System.out.println( "Error occurred while deleting user: " + deleteUserResult.getDeleteUserReturnStatus().getMessage() );
}
else {
    System.out.println( "User deleted: ID = " + userId );
}

                               
Permissions Required:
User and device -> Delete a user

attachSoftwareConfigurationToGroup

AttachSoftwareConfigurationToGroupResult attachSoftwareConfigurationToGroup(int groupId,
                                                                            int swconfigId)
Attaches a Software Configuration to a group.

Parameters:
groupId - the ID of the group to attach
swconfigId - the ID of the software configuration to attach group to
Since:
5.0.0
Sample:

Java CXF

AttachSoftwareConfigurationToGroupResult result=coreWebService.attachSoftwareConfigurationToGroup(groupId,swconfigId);
if (result.getAttachSoftwareConfigurationToGroupReturnStatus().getCode()!= AttachSoftwareConfigurationToGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getAttachSoftwareConfigurationToGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

resendPeerToPeerKeyToUser

ResendPeerToPeerKeyToUserResult resendPeerToPeerKeyToUser(int userId)
Resends the peer-to-peer encryption key for a user.

Parameters:
userId - the ID of the user to resend the peer-to-peer encryption key
Since:
5.0.0
Sample:

Java CXF

ResendPeerToPeerKeyToUserResult result= coreWebService.resendPeerToPeerKeyToUser(userId);
 
if (result.getResendPeerToPeerKeyToUserReturnStatus().getCode()!= ResendPeerToPeerKeyToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getResendPeerToPeerKeyToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR Resend data to devices

findGroups

FindGroupsResult findGroups(int organizationId,
                            java.lang.String locale)
Returns all available groups in a given organization. The data in the returned Group object is presented in the specified locale.

Parameters:
organizationId - the ID of the organization. Use 0 for default.
locale - the Group object returned will contain data in this locale
Returns:
Group objects representing all groups in the organization
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
 
FindGroupsResult result=coreWebService.findGroups(0, locale);
if (result.getFindGroupsReturnStatus().getCode()!= FindGroupsReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindGroupsReturnStatus().getMessage());
     return;
}
 
for (Group itr:result.getGroups()) {
    System.out.println("ID: " + itr.getGroupId());
}

                               
Permissions Required:
User and device -> View a group OR Organizations -> View a group across organizations

createUser

CreateUserResult createUser(UserEnableBlackBerryAttributes userEnableBlackBerryAttributes,
                            java.lang.String locale,
                            Group group,
                            ITPolicy itpolicy,
                            SoftwareConfiguration softwareConfiguration)
Creates a single BlackBerry Enabled user.

Parameters:
userEnableBlackBerryAttributes - describe the user to be added by populating this object
locale - the locale used when setting userEnabledBlackBerryAttributes
group - the group to add user to. use null if no group is needed.
itpolicy - the IT Policy to attach to the user. use null if no IT Policy attachment is needed.
softwareConfiguration - the software configuration to attach to the user. use null if no software configuration attachment is needed.
Returns:
the user ID of the newly created user
Since:
5.0.0
Sample:

Java CXF

//create search criteria
MailStoreUserSearchCriteria criteria=new MailStoreUserSearchCriteria();
 
//search by DisplayName
criteria.setDisplayName("Clyde Warren");
 
//create sort by enum
MailStoreUserSearchResultSortByEnum sortByEnum=new MailStoreUserSearchResultSortByEnum();
sortByEnum.setEnum(MailStoreUserSearchResultSortByEnumType.DISPLAY_NAME);
 
int pageSize=100;
String locale="en_US";
 
FindMailStoreUsersResult result=emailExchangeWebService.findMailStoreUsers(criteria, sortByEnum, true, locale, null, pageSize);
 
//loop through pages and create all users found matching the criteria
while (result.getFindMailStoreUsersReturnStatus().getCode() == FindMailStoreUsersReturnStatusEnumType.SUCCESS && result.getMailStoreUserSearchResult()!=null) {
    for (MailStoreUserSearchResult itr: result.getMailStoreUserSearchResult()) {
 
        //get the attributes needed in order to create a user by passing in the MailStoreUserSearchResult
        GatherEnableBlackBerryUserAttributesResult attributes=emailExchangeWebService.gatherEnableBlackBerryUserAttributes(itr, locale);
 
        //find the service instance to add the user to, but first, we need to find the service, then the service instance
        // set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
        // type is DispatcherService
        boolean includeSettings=true;
        FindServicesResult servicesResult=coreWebService.findServices(locale, includeSettings);
        if (servicesResult.getFindServicesReturnStatus().getCode()!= FindServicesReturnStatusEnumType.SUCCESS) {
            System.out.println("Error occurred: " + servicesResult.getFindServicesReturnStatus().getMessage());
            return;
        }
 
       ServiceType dispatcherService=null;
        for (ServiceType itr2:servicesResult.getServices()) {
            if (itr2 instanceof DispatcherService) {
                dispatcherService=itr2;
                break;
            }
        }
 
        if (dispatcherService==null) {
            System.out.println("Dispatcher Service not found");
            return;
        }
 
        // find the dispatcher instance on the server. this is needed for the serviceInstance
        // and targetserviceInstance fields of the UserEnableBlackBerryAttributes object
        boolean includeStatus=false;
        // this flag has to be set to true, or else none of the plug-in data will be loaded.
        // this is needed in order to find the Dispatcher service instance
        boolean includeExtendedData=true;
        boolean loadServiceConsumerRelationships=false;
        boolean loadServiceProducerRelationships=false;
        FindServiceInstancesByServiceResult serviceInstanceResult=coreWebService.findServiceInstancesByService(dispatcherService.getServiceId(), locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
        if (serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getCode()!= FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) {
            System.out.println("Error occurred: " + serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getMessage());
            return;
        }
 
        List<ServiceInstanceType> serviceInstances=serviceInstanceResult.getServiceInstances();
        ServiceInstanceType targetDispatcherInstance=null;
        for (ServiceInstanceType itr2:serviceInstances) {
 
            //find the Dispatcher instance by determining the type of the instance
            // the type should be DispatcherHostServiceInstance
            if (itr2 instanceof DispatcherHostServiceInstance) {
                //check to see if it is the dispatcher service instance you want by looking at the name
                if (itr2.getName().equalsIgnoreCase("server01")) {
                    targetDispatcherInstance=itr2;
                    break;
                }
            }
        }
 
        //call create User API
        if (targetDispatcherInstance==null) {
            System.out.println("DispatcherHostInstance not found");
        }
        //create UserEnableBlackBerryAttributes object needed for the createUser API.
        UserEnableBlackBerryAttributes userEnableBBAttributes=new UserEnableBlackBerryAttributes();
 
        //add all attributes found from the gatherEnableBlackBerryUserAttributes API
        // to the UserEnableBlackBerryAttributes object
        for (EnableBlackBerryUserAttributesType itr2:attributes.getEnableBlackBerryUserAttributes()) {
            userEnableBBAttributes.getEnableBlackBerryUserAttributes().add(itr2);
        }
 
        //set the serviceInstance
        userEnableBBAttributes.setServiceInstance(targetDispatcherInstance);
        //set the targetServiceInstance. this is the same as the service instance.
        //if moving a user, the targetServiceInstance would be different.
        userEnableBBAttributes.setTargetServiceInstance(targetDispatcherInstance);
 
        userEnableBBAttributes.setIgnoreDuplicateWarning(false);
        userEnableBBAttributes.setIgnoreEncryptionWarning(false);
        userEnableBBAttributes.setIgnoreInactiveTargetWarnings(false);
        userEnableBBAttributes.setFailOutstandingJobs(false);
        //set to default organization id
        userEnableBBAttributes.setOrganizationId(0);
 
        //get a list of groups
        FindGroupsResult findGroupsResult=coreWebService.findGroups(0, locale);
        if (findGroupsResult.getFindGroupsReturnStatus().getCode()!=FindGroupsReturnStatusEnumType.SUCCESS) {
            System.out.println("Group not found");
        }
 
        //get the first group
        Group targetGroup=null;                
        if (findGroupsResult.getGroups().size()>0) {
            targetGroup=findGroupsResult.getGroups().get(0);
        }
 
        //get a list of it policies
        boolean includePolicyItems=false;
        FindITPoliciesResult findITPoliciesResult=coreWebService.findITPolicies(locale, includePolicyItems);
        if (findITPoliciesResult.getFindITPoliciesReturnStatus().getCode()!=FindITPoliciesReturnStatusEnumType.SUCCESS) {
            System.out.println("IT Policies not found");
        }
        //get the first IT Policy
        ITPolicy targetITPolicy=null;
        if (findITPoliciesResult.getITPolicies().size()>0) {
            targetITPolicy=findITPoliciesResult.getITPolicies().get(0);
        }
 
        //get a list of software configurations
        boolean includeApplicationsData=false;
        boolean includeOSConfiguration=false;
        boolean includeApplicationControlPolicyMetaData=false;
        boolean includeSoftwareConfigurationApplicationControlPolicyMetaData=false;
        int organizationId=0;
        FindSoftwareConfigurationsResult findSoftwareConfigurationResult=coreWebService.findSoftwareConfigurations(locale,includeApplicationsData,includeOSConfiguration,includeApplicationControlPolicyMetaData, includeSoftwareConfigurationApplicationControlPolicyMetaData, organizationId);
        if (findSoftwareConfigurationResult.getFindSoftwareConfigurationsReturnStatus().getCode()!= FindSoftwareConfigurationsReturnStatusEnumType.SUCCESS) {
            System.out.println("Software Configuration not found");
            return;
        }
        //get the first software configuration
        SoftwareConfiguration targetSoftwareConfiguration=null;
        if (findSoftwareConfigurationResult.getSoftwareConfigurations().size()>0) {
            targetSoftwareConfiguration=findSoftwareConfigurationResult.getSoftwareConfigurations().get(0);
        }
 
        //call create user
        CreateUserResult createUserResult=coreWebService.createUser(userEnableBBAttributes, locale, targetGroup, targetITPolicy, targetSoftwareConfiguration);
        if (createUserResult.getCreateUserReturnStatus().getCode()!=CreateUserReturnStatusEnumType.SUCCESS) {
            System.out.println(createUserResult.getCreateUserReturnStatus().getMessage());
            return;
        }
 
        System.out.println("User added: ID=" + createUserResult.getUserId());
    }
 
    //quit loop if number of results is less than page size
    if (result.getMailStoreUserSearchResult().size() <pageSize) {
        break;
    }
    result=emailExchangeWebService.findMailStoreUsers(criteria, sortByEnum, true, locale, result.getMailStoreUserSearchResult().get(result.getMailStoreUserSearchResult().size()-1), pageSize);
}
 
if (result.getFindMailStoreUsersReturnStatus().getCode() != FindMailStoreUsersReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindMailStoreUsersReturnStatus().getMessage());
    return;
}

                               

C#

//create search criteria
MailStoreUserSearchCriteria criteria = new MailStoreUserSearchCriteria();
 
//search by DisplayName
criteria.displayName = userDisplayName;
 
//create sort by enum
MailStoreUserSearchResultSortByEnum sortByEnum = new MailStoreUserSearchResultSortByEnum();
sortByEnum.@enum = MailStoreUserSearchResultSortByEnumType.DISPLAY_NAME;
sortByEnum.enumSpecified = true;
 
int pageSize = 100;
String locale = "en_US";
 
findMailStoreUsers findMailStoreUsersRequest = new findMailStoreUsers();
findMailStoreUsersRequest.searchCriteria = criteria;
findMailStoreUsersRequest.sortByCriteria = sortByEnum;
findMailStoreUsersRequest.sortByAscendingOrder = true;
findMailStoreUsersRequest.criteriaAndResultSetLocale = locale;
findMailStoreUsersRequest.pageCriteria = null;
findMailStoreUsersRequest.pageSize = pageSize;
 
System.Console.WriteLine("calling findMailStoreUsers...");
 
findMailStoreUsersResponse findMailStoreUsersResponse = emailExchangeWebService.findMailStoreUsers(findMailStoreUsersRequest);
FindMailStoreUsersResult result = findMailStoreUsersResponse.returnValue;
 
//loop through pages and create all users found matching the criteria
while (result.findMailStoreUsersReturnStatus.code == FindMailStoreUsersReturnStatusEnumType.SUCCESS && result.mailStoreUserSearchResult!=null)
{
    for (int i = 0; i < result.mailStoreUserSearchResult.Length; i++)
    {
 
        //get the attributes needed in order to create a user by passing in the MailStoreUserSearchResult
        gatherEnableBlackBerryUserAttributes gatherEnableBlackBerryUserAttributesRequest = new gatherEnableBlackBerryUserAttributes();
        gatherEnableBlackBerryUserAttributesRequest.result = result.mailStoreUserSearchResult[i];
        gatherEnableBlackBerryUserAttributesRequest.locale = locale;

        System.Console.WriteLine("calling gatherEnableBlackBerryUserAttributes...");
        gatherEnableBlackBerryUserAttributesResponse gatherEnableBlackBerryUserAttributesResponse = emailExchangeWebService.gatherEnableBlackBerryUserAttributes(gatherEnableBlackBerryUserAttributesRequest);
        GatherEnableBlackBerryUserAttributesResult attributesResult = gatherEnableBlackBerryUserAttributesResponse.returnValue;
        if (attributesResult.gatherEnableBlackBerryUserAttributesReturnStatus.code != GatherEnableBlackBerryUserAttributesReturnStatusEnumType.SUCCESS)
        {
            System.Console.WriteLine("Error occurred: " + attributesResult.gatherEnableBlackBerryUserAttributesReturnStatus.message);
            return;
        }
 
        // find the service instance to add the user to, but first, we need to find the service, then the service instance
        findServices findServicesRequest = new findServices();
        // set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
        // type is DispatcherService
        findServicesRequest.includeSettings = true;
        findServicesRequest.locale = locale;
 
        System.Console.WriteLine("calling findServices...");
        findServicesResponse findServicesResponse = coreWebService.findServices(findServicesRequest);
        FindServicesResult servicesResult = findServicesResponse.returnValue;
 
        if (servicesResult.findServicesReturnStatus.code != FindServicesReturnStatusEnumType.SUCCESS)
        {
            System.Console.WriteLine("Error occurred: " + servicesResult.findServicesReturnStatus.message);
            return;
        }
 
        ServiceType dispatcherService = null;
        for (int j = 0; j < servicesResult.services.Length; j++)
        {
            if (servicesResult.services[j].GetType().Equals(typeof(DispatcherService)))
            {
                dispatcherService = servicesResult.services[j];
                break;
            }
        }
 
        if (dispatcherService == null)
        {
            System.Console.WriteLine("Dispatcher Service not found");
            return;
        }
 
        // find the dispatcher instance on the server. this is what is needed for the serviceInstance
        // and targetserviceInstance fields of the UserEnableBlackBerryAttributes object
        findServiceInstancesByService findServiceInstancesByServiceRequest = new findServiceInstancesByService();
        findServiceInstancesByServiceRequest.serviceId = dispatcherService.serviceId;
        findServiceInstancesByServiceRequest.locale = locale;
        findServiceInstancesByServiceRequest.includeStatus = false;
        findServiceInstancesByServiceRequest.loadServiceConsumerRelationships = false;
        findServiceInstancesByServiceRequest.loadServiceProducerRelationships = false;
        // this flag has to be set to true, or else none of the plug-in data will be loaded.
        // this is needed in order to find the Dispatcher service instance
        findServiceInstancesByServiceRequest.includeExtendedData = true;
 
        System.Console.WriteLine("calling findServiceInstancesByService...");
        findServiceInstancesByServiceResponse findServiceInstancesByServiceResponse = coreWebService.findServiceInstancesByService(findServiceInstancesByServiceRequest);
        FindServiceInstancesByServiceResult serviceInstanceResult = findServiceInstancesByServiceResponse.returnValue;
        if (serviceInstanceResult.findServiceInstancesByServiceReturnStatus.code != FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS)
        {
            System.Console.WriteLine("Error occurred: " + serviceInstanceResult.findServiceInstancesByServiceReturnStatus.message);
            return;
        }
 
        ServiceInstanceType targetDispatcherInstance = null;
        for (int j = 0; j < serviceInstanceResult.serviceInstances.Length; j++)
        {
 
            //find the Dispatcher instance by determining the type of the instance
            // the type should be DispatcherHostServiceInstance
            if (serviceInstanceResult.serviceInstances[j].GetType().Equals(typeof(DispatcherHostServiceInstance)))
            {
 
                //check to see if it is the dispatcher service instance you want by looking at the name
                if (serviceInstanceResult.serviceInstances[j].name.ToUpper().Equals(dispatcherInstanceName.ToUpper()))
                {
                    targetDispatcherInstance = serviceInstanceResult.serviceInstances[j];
                    break;
                }
            }
        }

        //call create User API
        if (targetDispatcherInstance == null)
        {
            System.Console.WriteLine("DispatcherHostInstance not found");
            return;
        }
        //create UserEnableBlackBerryAttributes object needed for the createUser API.
        UserEnableBlackBerryAttributes userEnableBBAttributes = new UserEnableBlackBerryAttributes();

        //add all attributes found from the gatherEnableBlackBerryUserAttributes API
        // to the UserEnableBlackBerryAttributes object
        userEnableBBAttributes.enableBlackBerryUserAttributes = new EnableBlackBerryUserAttributesType[attributesResult.enableBlackBerryUserAttributes.Length];
        for (int j = 0; j < attributesResult.enableBlackBerryUserAttributes.Length; j++)
        {
            userEnableBBAttributes.enableBlackBerryUserAttributes[j] = attributesResult.enableBlackBerryUserAttributes[j];
        }
 
        //set the serviceInstance
        userEnableBBAttributes.serviceInstance = targetDispatcherInstance;
        //set the targetServiceInstance. this is the same as the service instance.
        userEnableBBAttributes.targetServiceInstance = targetDispatcherInstance;
 
        userEnableBBAttributes.ignoreDuplicateWarning = false;
        userEnableBBAttributes.ignoreDuplicateWarningSpecified = true;
 
        userEnableBBAttributes.ignoreEncryptionWarning = false;
        userEnableBBAttributes.ignoreEncryptionWarningSpecified = true;
 
        userEnableBBAttributes.ignoreInactiveTargetWarnings = false;
        userEnableBBAttributes.ignoreInactiveTargetWarningsSpecified = true; 
 
        userEnableBBAttributes.failOutstandingJobs = false;
        userEnableBBAttributes.failOutstandingJobsSpecified = true;
 
        //set to default organization Id
        userEnableBBAttributes.organizationId = 0;
        userEnableBBAttributes.organizationIdSpecified = true;
 
        //call create user
        createUser createUserRequest = new createUser();
        createUserRequest.userEnableBlackBerryAttributes = userEnableBBAttributes;
        createUserRequest.locale = locale;
        createUserRequest.group = null;
        createUserRequest.itpolicy = null;
        createUserRequest.softwareConfiguration = null;
 
        System.Console.WriteLine("calling createUser...");
 
        createUserResponse createUserResponse = coreWebService.createUser(createUserRequest);
        CreateUserResult createUserResult = createUserResponse.returnValue;
        if (createUserResult.createUserReturnStatus.code != CreateUserReturnStatusEnumType.SUCCESS)
        {
            System.Console.WriteLine(createUserResult.createUserReturnStatus.message);
            continue;
        }

        System.Console.WriteLine("User added: ID=" + createUserResult.userId);
    }
 
    findMailStoreUsersRequest.pageCriteria = result.mailStoreUserSearchResult[result.mailStoreUserSearchResult.Length - 1];
 
    findMailStoreUsersResponse = emailExchangeWebService.findMailStoreUsers(findMailStoreUsersRequest);
    result = findMailStoreUsersResponse.returnValue;
}
 
if (result.findMailStoreUsersReturnStatus.code != FindMailStoreUsersReturnStatusEnumType.SUCCESS)
{
    System.Console.WriteLine("Error occurred: " + result.findMailStoreUsersReturnStatus.message);
}

                               
Permissions Required:
User and device -> Create a user
User and device -> Add or remove to user configuration
User and device -> Edit a user
User and device -> Edit a group OR Organizations -> Edit a group across organizations

findUsers

FindUsersResult findUsers(UserSearchCriteria searchCriteria,
                          BASEnumBaseDTO sortBy,
                          boolean sortAscendingOrder,
                          java.lang.String locale,
                          UserSearchResult lastResultElement,
                          int pageSize)
Finds a user or a list of users for a given search criteria.

Parameters:
searchCriteria - the search criteria contains a collection of user search criteria service attributes
sortBy - the sort order of the result. Use classes with name *UserSearchResultSortByEnum
sortAscendingOrder - ascending if true, descending otherwise
locale - the locale to be used.
lastResultElement - the last result element. used for retrieving the next page.
pageSize - the size of the paged results
Returns:
User(s) matching search criteria
Since:
5.0.0
Sample:

Java CXF

UserSearchCriteria userSearchCriteria=new UserSearchCriteria();
 
//search by DisplayName
BASUserSearchCriteriaServiceAttributes BASCriteria=new BASUserSearchCriteriaServiceAttributes();
BASCriteria.setDisplayName("Clyde Warren");
userSearchCriteria.getUserSearchCriteriaServiceAttributes().add(BASCriteria);
 
//set the sort order
BASUserSearchResultSortByEnum sortByEnum=new BASUserSearchResultSortByEnum();
sortByEnum.setEnum(BASUserSearchResultSortByEnumType.DISPLAY_NAME);
 
int pageSize=100;
String locale="en_US";
boolean sortAscending=true;
 
//call findUsers api passing in null as lastresult to get the first page
FindUsersResult result=coreWebService.findUsers(userSearchCriteria, sortByEnum, sortAscending, locale, null, pageSize);
 

//loop through pages
while (result.getFindUsersReturnStatus().getCode()==FindUsersReturnStatusEnumType.SUCCESS && result.getUserSearchResult()!=null) {
   List<UserSearchResult> results=result.getUserSearchResult();
    for (UserSearchResult itr:results) {
        for (UserSearchResultServiceAttributesType itr2: itr.getUserSearchResultServiceAttributes()) {
            if (itr2 instanceof BASUserSearchResultServiceAttributesType) {
                BASUserSearchResultServiceAttributesType BASAttributes=(BASUserSearchResultServiceAttributesType) itr2;
                System.out.println("User ID: " + BASAttributes.getUserId());
                System.out.println("Display Name: " + BASAttributes.getDisplayName());
            }
        }

    }

    //fetch next page by passing in the last UserSearchResult object in the previous list
    result=coreWebService.findUsers(userSearchCriteria, sortByEnum, sortAscending, locale, result.getUserSearchResult().get(result.getUserSearchResult().size()-1), pageSize);

}

if (result.getFindUsersReturnStatus().getCode()!=FindUsersReturnStatusEnumType.SUCCESS) {
  //error occurred
}


         

Java CXF

// find users by email address

UserSearchCriteria userSearchCriteria=new UserSearchCriteria();

//search by email address.  Make sure to instantiate the platform specific type. In the case of Exchange, do the following:
EmailCommonUserSearchCriteriaServiceAttributesType emailCriteria=new EmailExchangeUserSearchCriteriaServiceAttributes();

emailCriteria.setUserEmailAddress("clyde.warren@test.rim.net");
userSearchCriteria.getUserSearchCriteriaServiceAttributes().add(emailCriteria);

//While BlackBerry services for a user are being disabled, that user will temporarily not be returned in the findUsers()
//result unless the search criteria for QueuedRemovalOfBESServices is set. To search for users being disabled:
//
//EmailExchangeUserSearchCriteriaServiceAttributesType emailCriteria=new EmailExchangeUserSearchCriteriaServiceAttributes();
//
//emailCriteria.setQueuedRemovalOfBESServices(true);
//userSearchCriteria.getUserSearchCriteriaServiceAttributes().add(emailCriteria);

//set the sort order
BASUserSearchResultSortByEnum sortByEnum=new BASUserSearchResultSortByEnum();
sortByEnum.setEnum(BASUserSearchResultSortByEnumType.DISPLAY_NAME);

int pageSize=100;
String locale="en_US";
boolean sortAscending=true;

//call findUsers api passing in null as lastresult to get the first page
FindUsersResult result= coreWebService.findUsers(userSearchCriteria, sortByEnum, sortAscending, locale, null, pageSize);

//loop through pages
while (result.getFindUsersReturnStatus().getCode()==FindUsersReturnStatusEnumType.SUCCESS && result.getUserSearchResult()!=null && result.getUserSearchResult().size()>0) {
       List<UserSearchResult> results=result.getUserSearchResult();
       for (UserSearchResult itr:results) {
               for (UserSearchResultServiceAttributesType itr2: itr.getUserSearchResultServiceAttributes()) {
                       if (itr2 instanceof BASUserSearchResultServiceAttributesType) {
                               BASUserSearchResultServiceAttributesType BASAttributes=(BASUserSearchResultServiceAttributesType) itr2;
                               System.out.println("User ID: " + BASAttributes.getUserId());
                               System.out.println("Display Name: " + BASAttributes.getDisplayName());
                       }
               }
 
       }

       //fetch next page by passing in the last UserSearchResult object in the previous list
       result= coreWebService.findUsers(userSearchCriteria, sortByEnum, sortAscending, locale, result.getUserSearchResult().get(result.getUserSearchResult().size()-1), pageSize);
 
 }
 
if (result.getFindUsersReturnStatus().getCode()!=FindUsersReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getFindUsersReturnStatus().getMessage());
}

                               

C#

findUsersResponse response;
 
findUsers findUsersRequest = new findUsers();
 
UserSearchCriteria searchCriteria = new UserSearchCriteria();
BASUserSearchCriteriaServiceAttributes basServiceAttributes = new BASUserSearchCriteriaServiceAttributes();
basServiceAttributes.displayName = userDisplayName;
searchCriteria.userSearchCriteriaServiceAttributes = new UserSearchCriteriaServiceAttributesType[1];
searchCriteria.userSearchCriteriaServiceAttributes[0] = basServiceAttributes;
findUsersRequest.searchCriteria = searchCriteria;
 
int pageSize = 100;
UserSearchResult lastResultElement = null;
 
findUsersRequest.locale = "en_US";
 
findUsersRequest.sortAscendingOrder = true;
 
//set the page size
findUsersRequest.pageSize = pageSize;

//prepare and set the sort by
BASUserSearchResultSortByEnum sortBy = new BASUserSearchResultSortByEnum();
sortBy.@enum = BASUserSearchResultSortByEnumType.DISPLAY_NAME;
sortBy.enumSpecified = true;
findUsersRequest.sortBy = sortBy;
 
//call findUsers api
response = coreWebService.findUsers(findUsersRequest);
 
//loop through pages
while (response.returnValue.userSearchResult != null && response.returnValue.userSearchResult!=null)
{

    //print metadata
    System.Console.WriteLine("API Status [{0}]; Execution Time [{1}]s",
        response.returnValue.metadata.APIStatusSpecified ? response.returnValue.metadata.APIStatus : APIStatusEnumType.NOT_YET_IMPLEMENTED,
        response.returnValue.metadata.executionTimeSpecified ? response.returnValue.metadata.executionTime / 1000000000.0 : -1);
 
    //check return status
    if (response.returnValue.findUsersReturnStatus.code != FindUsersReturnStatusEnumType.SUCCESS)
    {
        System.Console.Error.WriteLine(response.returnValue.findUsersReturnStatus.message);
        break;
    }
 
    //print number of search results on this page
    System.Console.WriteLine("results # [{0}]",
        (response.returnValue.userSearchResult != null) ? response.returnValue.userSearchResult.Length : 0);
 
    //print the results:
    for (int i = 0; i < response.returnValue.userSearchResult.Length; i++)
    {
        //Each user response element is a rainbow object
        UserSearchResult searchResult = response.returnValue.userSearchResult[i];
        UserSearchResultServiceAttributesType[] serviceAttributes = searchResult.userSearchResultServiceAttributes;

        //loop through the service attributes and determine the concrete datatype of 
        //each attribute
        for (int j = 0; j < serviceAttributes.Length; j++)
        {
            if (serviceAttributes[j].GetType().Equals(typeof(BASUserSearchResultServiceAttributes)))
            {
                BASUserSearchResultServiceAttributesType basServiceResultAttributes = serviceAttributes[j] as BASUserSearchResultServiceAttributesType;
                System.Console.WriteLine("\tName:" + basServiceResultAttributes.displayName);
            }
            else if (serviceAttributes[j].GetType().Equals(typeof(DispatcherUserSearchResultServiceAttributes)))
            {
                DispatcherUserSearchResultServiceAttributesType dispatcherResultAttributes = serviceAttributes[j] as DispatcherUserSearchResultServiceAttributesType;
                System.Console.WriteLine("\tDispatcher service instance name:" + dispatcherResultAttributes.dispatcherServiceInstanceName);
            }
            else if (serviceAttributes[j].GetType().Equals(typeof(EmailExchangeUserSearchResultServiceAttributes)))
            {
                EmailExchangeUserSearchResultServiceAttributesType emailResultAttributes = serviceAttributes[j] as EmailExchangeUserSearchResultServiceAttributesType;
                System.Console.WriteLine(String.Format("\tEmail Server[{0}]; email address [{1}]; User State [{2}]:",
                                         emailResultAttributes.mailServerName,
                                         emailResultAttributes.userEmailAddress,
                                         emailResultAttributes.userState));
            }
            else
            {
                System.Console.WriteLine("\t attribute " + serviceAttributes[j].GetType().Name);
            }
 
        }
        System.Console.WriteLine("");
    }
 
    //set the last element to be the last search result entry
    lastResultElement = response.returnValue.userSearchResult[response.returnValue.userSearchResult.Length - 1];
    findUsersRequest.lastResultElement = lastResultElement;
 
    //get the next page
    response = coreWebService.findUsers(findUsersRequest);
}

                               
Permissions Required:
Current user OR User and device -> View a user
User and device -> View a group OR Organizations -> View a group across organizations
BlackBerry Administration Service setup -> View a role
User and device -> View a software configuration
User and device -> View an IT policy
Topology -> View rules for the BlackBerry MDS Connection Service
User and device -> View a device OR Organizations -> View a device across organizations

resendReconciledApplicationsToUser

ResendReconciledApplicationsToUserResult resendReconciledApplicationsToUser(int userId,
                                                                            java.util.List<ReconciledApplication> reconciledApplications)
Resends a list of reconciled applications to a user. Use findReconciledApplicationsForUser to obtain a list of reconciled applications first.

Parameters:
userId - the ID of the user to resend the applications to
reconciledApplications - a list of reconciled applications to send to the user
Since:
5.0.0
Sample:

Java CXF

//get reconciled applications first
String locale="en_US";
 
FindReconciledApplicationsForUserResult result=coreWebService.findReconciledApplicationsForUser(userId, locale);
 
if (result.getFindReconciledApplicationsForUserReturnStatus().getCode() != FindReconciledApplicationsForUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindReconciledApplicationsForUserReturnStatus().getMessage());
    return;
}
 
List<ReconciledApplication> reconciledApplications=result.getReconciledApplication();
for (ReconciledApplication itr:reconciledApplications) {
    System.out.println("Application Delivery Mode: " + itr.getObjectDeliveryModeType().value());
    System.out.println("Application Name: " + itr.getApplicationLocaleNameAndDescription().get(0).getName());
    System.out.println("Application Version: " + itr.getApplicationVersion());
}
 
//resend all of the reconciled applications
ResendReconciledApplicationsToUserResult resendResult=coreWebService.resendReconciledApplicationsToUser(userId, reconciledApplications);
if (resendResult.getResendReconciledApplicationsToUserReturnStatus().getCode() != ResendReconciledApplicationsToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + resendResult.getResendReconciledApplicationsToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR Resend data to devices

deleteUsers

DeleteUsersResult deleteUsers(java.util.List<java.lang.Integer> userIds)
Deletes the users specified by their user Ids.

Parameters:
userIds - the Ids of the users to delete
Since:
5.0.0
Sample:

Java CXF

DeleteUsersResult deleteUsersResult = coreWebService.deleteUsers( userIds );
if( deleteUsersResult.getDeleteUsersReturnStatus().getCode() != DeleteUserReturnStatusEnumType.SUCCESS ) {
    System.out.println( "One or more errors occurred while deleting users:" );
    List<DeleteUsersReturnResult> returnResults = deleteUsersResult.getDeleteUsersReturnResult();
    for( int count = 0; count < returnResults.size(); count++ ) {
        DeleteUserReturnStatus returnStatus = returnResults.get( count ).getDeleteUserReturnStatus();
        if( returnStatus.getCode() != DeleteUserReturnStatusEnumType.SUCCESS ) {
            System.out.println( "Error while deleting user ID " +
                    userIds.get(count).toString() + ": " + 
                    returnStatus.getMessage() );
        }
    }
}
else {
    System.out.println( "Users deleted" );
}

                               
Permissions Required:
User and device -> Delete a user

findSoftwareConfigurationsForGroup

FindSoftwareConfigurationsForGroupResult findSoftwareConfigurationsForGroup(int groupId)
Returns all Software Configurations directly assigned to a group.

Parameters:
groupId - the ID of the group
Returns:
softwareConfigurationIds IDs of the Software Configurations assigned to the group
Since:
5.0.0
Sample:

Java CXF

FindSoftwareConfigurationsForGroupResult result= coreWebService.findSoftwareConfigurationsForGroup(groupId);
if (result.getFindSoftwareConfigurationsForGroupReturnStatus().getCode()!= FindSoftwareConfigurationsForGroupReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getFindSoftwareConfigurationsForGroupReturnStatus().getMessage());
       return;
}
 
for (int itr:result.getSoftwareConfigurationIds()) {
       System.out.println("Id: " + itr);
}

                               
Permissions Required:
User and device -> View a software configuration
User and device -> View a group OR Organizations -> View a group across organizations

findSoftwareConfigurationsForUser

FindSoftwareConfigurationsForUserResult findSoftwareConfigurationsForUser(int userId)
Returns all Software Configurations directly assigned to a user.

Parameters:
userId - the ID of the user
Returns:
softwareConfigurationIds IDs of the Software Configurations assigned to the user
Since:
5.0.0
Sample:

Java CXF

FindSoftwareConfigurationsForUserResult result= coreWebService.findSoftwareConfigurationsForUser(userId);
if (result.getFindSoftwareConfigurationsForUserReturnStatus().getCode()!= FindSoftwareConfigurationsForUserReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getFindSoftwareConfigurationsForUserReturnStatus().getMessage());
       return;
}
 
for (int itr:result.getSoftwareConfigurationIds()) {
       System.out.println("Id: " + itr);
}

                               
Permissions Required:
Current user OR User and device -> View a user AND User and device -> View a software configuration

findCapabilityDefinitions

FindCapabilityDefinitionsResult findCapabilityDefinitions(java.lang.String locale)
Returns definitions for all capabilities.

Parameters:
locale - the locale of the returned capability definitions
Returns:
Capability definitions
Since:
5.0.0
Sample:

Java CXF

FindCapabilityDefinitionsResult result= coreWebService.findCapabilityDefinitions(locale);
if (result.getFindCapabilityDefinitionsReturnStatus().getCode()!= FindCapabilityDefinitionsReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindCapabilityDefinitionsReturnStatus().getMessage());
    return;
}
 
for (CapabilityDefinition itr:result.getCapabilityDefinitions()) {
    System.out.println("Name: " + itr.getName());
}

                               
Permissions Required:
None required

setGroup

SetGroupResult setGroup(Group group,
                        java.lang.String locale)
Updates a Group.

Parameters:
group - the group to update. contains the latest group information to update
locale - the locale of the data to update, or null if no locale based data is to be updated
Since:
5.0.0
Sample:

Java CXF

System.out.println("Group ID: " + group.getGroupId());
System.out.println("Group Name: " + group.getLocaleNameAndDescription().get(0).getName());
System.out.println("Child Groups: ");
 
//change the name of the group for the en_US locale
for (LocaleNameAndDescription itr: group.getLocaleNameAndDescription()) {
    if (itr.getLocale().equalsIgnoreCase("en_US")) {
        itr.setName("New group name");
    }
}
 
SetGroupResult setGroupResult= coreWebService.setGroup(group, locale);
 
if (setGroupResult.getSetGroupReturnStatus().getCode() != SetGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + setGroupResult.getSetGroupReturnStatus().getMessage());
}

                               
Permissions Required:
User and device -> Edit a group OR Organizations -> Edit a group across organizations

removeUsersFromGroup

RemoveUsersFromGroupResult removeUsersFromGroup(int groupId,
                                                java.util.List<java.lang.Integer> userIds)
Removes multiple users from a single group.

Parameters:
groupId - the ID of the group to remove users from
userIds - the ID of the users to remove
Since:
5.0.0
Sample:

Java CXF

RemoveUsersFromGroupResult result=coreWebService.removeUsersFromGroup(groupId, userIds);
if (result.getRemoveUsersFromGroupReturnStatus().getCode()!=RemoveUserFromGroupReturnStatusEnumType.SUCCESS) {
    //error occurred
    System.out.println(result.getRemoveUsersFromGroupReturnStatus().getMessage());
    if (result.getRemoveUsersFromGroupReturnStatus().getCode()==RemoveUserFromGroupReturnStatusEnumType.RESULT_ERROR_EXISTS) {
        for (RemoveUsersFromGroupReturnResult itr:result.getRemoveUsersFromGroupReturnResult()) {
            System.out.println("code: " + itr.getRemoveUserFromGroupReturnStatus().getCode().value());
            System.out.println("message: " + itr.getRemoveUserFromGroupReturnStatus().getMessage());
        }
    }
}

                               
Permissions Required:
User and device -> Edit a user
User and device -> Edit a group OR Organizations -> Edit a group across organizations

findITPolicies

FindITPoliciesResult findITPolicies(java.lang.String locale,
                                    boolean includePolicyItems)
Returns all IT policies. The data in the returned ITPolicy object is presented in the specified locale.

Parameters:
locale - the Group object returned will contain data in this locale
includePolicyItems - if set to true, the ITPolicyItem field of the ITPolicy object will be set
Returns:
ITPolicy objects representing all IT Policies in the organization
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
  
FindITPoliciesResult result=coreWebService.findITPolicies(locale, false);
if (result.getFindITPoliciesReturnStatus().getCode()!= FindITPoliciesReturnStatusEnumType.SUCCESS) {
     System.out.println("Error occurred: " + result.getFindITPoliciesReturnStatus().getMessage());
     return;
}
 
for (ITPolicy itr:result.getITPolicies()) {
    System.out.println("ID: " + itr.getPolicyId());
    System.out.println("Name: " + itr.getPolicyName());
}

                               
Permissions Required:
User and device -> View an IT Policy

findVPNConfigurations

FindVPNConfigurationsResult findVPNConfigurations(java.lang.String locale,
                                                  boolean includePolicyItems)
Returns all available VPN configurations. The data in the returned ITPolicy object is presented in the specified locale.

Parameters:
locale - the ITPolicy object returned will contain data in this locale
includePolicyItems - if set to true, the ITPolicyItem field of the ITPolicy object will be set
Returns:
ITPolicy objects representing all VPN Configurations
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean includePolicyItems=true;
FindVPNConfigurationsResult VPNConfigurationsResult= coreWebService.findVPNConfigurations(locale, includePolicyItems);
if (VPNConfigurationsResult.getFindVPNConfigurationsReturnStatus().getCode()!= FindVPNConfigurationsReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + VPNConfigurationsResult.getFindVPNConfigurationsReturnStatus().getMessage());
               return;
}
 
for (ITPolicy itr:VPNConfigurationsResult.getITPolicies()) {
       System.out.println("VPN Config Name: " + itr.getPolicyName());            
}

                               
Permissions Required:
User and device -> View an IT Policy

addUsersToGroup

AddUsersToGroupResult addUsersToGroup(int groupId,
                                      java.util.List<java.lang.Integer> userIds)
Adds multiple users to a single group.

Parameters:
groupId - the ID of the group to add users to
userIds - the ID of the users to add
Since:
5.0.0
Sample:

Java CXF

AddUsersToGroupResult result=coreWebService.addUsersToGroup(groupId, userIds);
if (result.getAddUsersToGroupReturnStatus().getCode()!=AddUserToGroupReturnStatusEnumType.SUCCESS) {
    //error occurred
    System.out.println(result.getAddUsersToGroupReturnStatus().getMessage());
    if (result.getAddUsersToGroupReturnStatus().getCode()==AddUserToGroupReturnStatusEnumType.RESULT_ERROR_EXISTS) {
        for (AddUsersToGroupReturnResult itr:result.getAddUsersToGroupReturnResult()) {
            System.out.println("code: " + itr.getAddUserToGroupReturnStatus().getCode().value());
            System.out.println("message: " + itr.getAddUserToGroupReturnStatus().getMessage());
        }
    }
}

                               
Permissions Required:
User and device -> Edit a user
User and device -> Edit a group OR Organizations -> Edit a group across organizations

assignWLANConfigurationToUser

AssignWLANConfigurationToUserResult assignWLANConfigurationToUser(int wlanBaseConfigSetId,
                                                                  int userId)
Assigns a WLAN configuration to a user.

Parameters:
wlanBaseConfigSetId - the WLAN configuration set ID to assign
userId - the ID of the user to attach
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
//get the WLAN configuration
boolean includePolicyItems=true;
FindWLANConfigurationsResult WLANConfigurationsResult= coreWebService.findWLANConfigurations(locale, includePolicyItems);
if (WLANConfigurationsResult.getFindWLANConfigurationsReturnStatus().getCode()!= FindWLANConfigurationsReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + WLANConfigurationsResult.getFindWLANConfigurationsReturnStatus().getMessage());
       return;
}
 
if (WLANConfigurationsResult.getITPolicies().size()>0) {
       //assign the first available WLAN configuration to the user
       int WLANConfigId=WLANConfigurationsResult.getITPolicies().get(0).getPolicyId();
       AssignWLANConfigurationToUserResult result= coreWebService.assignWLANConfigurationToUser(WLANConfigId, userId);
       if (result.getAssignWLANConfigurationToUserReturnStatus().getCode() != AssignWLANConfigurationToUserReturnStatusEnumType.SUCCESS) {
               System.out.println("Error occurred: " + result.getAssignWLANConfigurationToUserReturnStatus().getMessage());
       }
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

findServiceInstancesByService

FindServiceInstancesByServiceResult findServiceInstancesByService(int serviceId,
                                                                  java.lang.String locale,
                                                                  boolean includeStatus,
                                                                  boolean includeExtendedData,
                                                                  boolean loadServiceConsumerRelationships,
                                                                  boolean loadServiceProducerRelationships)
Returns all service instances of a specified service. The data in the returned ServiceInstanceType object is presented in the specified locale. Use boolean values to control what fields to return. For example, if you would like to know the status of the service instances, set boolean "includeStatus" to true, and the returned Service Instance object will have the status field set.

Parameters:
serviceId - the ID of the service. Use the findServices API to retrieve the ServiceType Object.
locale - the ServiceInstanceType object returned will contain data in this locale
includeStatus - if set to true, the Status field of the returned Service Instance will be set
includeExtendedData - if set to true, all plug-in related data will be set
loadServiceConsumerRelationships - if set to true, Service Consumer related fields will be set
loadServiceProducerRelationships - if set to true, Service Producer related fields will be set
Returns:
Service Instance object matching the given Server ID. Any service instance object that does not have an associated windows service will have status of 'UNKNOWN'. This list includes: Email{platform}CoreServiceInstance, Email{platform}AgentServiceInstance, LoggingServiceInstance, AttachmentConnectorServiceInstance and RouterServiceInstance.
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean includeStatus=false;
boolean includeExtendedData=true;
boolean loadServiceConsumerRelationships=false;
boolean loadServiceProducerRelationships=false;
  
FindServiceInstancesByServiceResult result=coreWebService.findServiceInstancesByService(3, locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
  
if (result.getFindServiceInstancesByServiceReturnStatus().getCode()!= FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindServiceInstancesByServiceReturnStatus().getMessage());
    return;
}
  
List<ServiceInstanceType> serviceInstances=result.getServiceInstances();
for (ServiceInstanceType itr:serviceInstances) {
    System.out.println(itr.getName());
}

                               
Permissions Required:
Topology -> View an Instance

removeGroupFromGroup

RemoveGroupFromGroupResult removeGroupFromGroup(int destinationGroupId,
                                                int groupId)
Removes a group from a native group.

Parameters:
destinationGroupId - the ID of the native group to remove a group from
groupId - the ID of the group to remove
Since:
5.0.0
Sample:

Java CXF

RemoveGroupFromGroupResult result=coreWebService.removeGroupFromGroup(destinationGroupId,groupId);
if (result.getRemoveGroupFromGroupReturnStatus().getCode()!= RemoveGroupFromGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getRemoveGroupFromGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Edit a group OR Organizations -> Edit a group across organizations

removeUserFromGroup

RemoveUserFromGroupResult removeUserFromGroup(int groupId,
                                              int userId)
Removes a user from a group.

Parameters:
groupId - the ID of the group to remove user from
userId - the ID of the user to remove
Since:
5.0.0
Sample:

Java CXF

RemoveUserFromGroupResult result=coreWebService.removeUserFromGroup(groupId,userId);
if (result.getRemoveUserFromGroupReturnStatus().getCode()!= RemoveUserFromGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getRemoveUserFromGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Edit a user
User and device -> Edit a group OR Organizations -> Edit a group across organizations

getGroup

GetGroupResult getGroup(int groupId,
                        java.lang.String locale,
                        boolean loadGroupChildGroups,
                        boolean loadGroupParentGroups,
                        boolean loadGroupDirectUsers,
                        boolean loadGroupDirectAssignments)
Returns a group given a group ID.

Parameters:
groupId - the groupId to look for
locale - the locale of the returned data
loadGroupChildGroups - load the groupChildGroups property if set to true
loadGroupParentGroups - load the groupParentGroups property if set to true
loadGroupDirectUsers - load the groupUsers property if set to true
loadGroupDirectAssignments - load the groupMember property if set to true
Returns:
Group object containing details about the group
Since:
5.0.0
Sample:

Java CXF

boolean loadGroupChildGroups=true;
boolean loadGroupParentGroups=true;
boolean loadGroupDirectUsers=true;
boolean loadGroupDirectAssignments=true;
GetGroupResult result= coreWebService.getGroup(groupId, locale, loadGroupChildGroups, loadGroupParentGroups, loadGroupDirectUsers, loadGroupDirectAssignments);

if (result.getGetGroupReturnStatus().getCode() != GetGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getGetGroupReturnStatus().getMessage());
    return;
}
 
Group group=result.getGroup();
System.out.println("Group ID: " + group.getGroupId());
System.out.println("Group Name: " + group.getLocaleNameAndDescription().get(0).getName());
System.out.println("Child Groups: ");
for (Group itr:group.getGroupChildGroups().getGroup()) {
    System.out.print(itr.getGroupId() + " ");
}

                               
Permissions Required:
User and device -> View a group OR Organizations -> View a group across organizations

setUser

SetUserResult setUser(User user,
                      java.lang.String locale)
Updates a User.

Parameters:
user - the user to update. contains the latest user information to update
locale - the locale of the data to update, or null if no locale based data is to be updated
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean loadUserServiceAttributes=true;
boolean loadUserDeviceConfigurationServiceAttributes=true;
boolean loadUserResolvedGroups=true;
boolean loadUserResolvedGroupIds=true;
boolean loadUserGroups=true;
GetUserResult result= coreWebService.getUser(userId, locale, loadUserServiceAttributes, loadUserDeviceConfigurationServiceAttributes, loadUserResolvedGroups, loadUserResolvedGroupIds, loadUserGroups);
 
if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getGetUserReturnStatus().getMessage());
    return;
}
 
User user=result.getUser();
System.out.println("User ID: " + user.getUserId());
System.out.println("Login Name: " + user.getLoginName());
System.out.println("Display Name: " + user.getDisplayName());
user.setDisplayName("Clyde Warren");
SetUserResult setUserResult=coreWebService.setUser(user, locale);

if (setUserResult.getSetUserReturnStatus().getCode() != SetUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + setUserResult.getSetUserReturnStatus().getMessage());
}

                               

Java CXF

// Assign WLAN configuration to a user
String locale="en_US";
boolean loadUserServiceAttributes=true;
boolean loadUserDeviceConfigurationServiceAttributes=true;
boolean loadUserResolvedGroups=true;
boolean loadUserResolvedGroupIds=true;
boolean loadUserGroups=true;
boolean loadUserWLANVPNVOIPConfigurations=true;
GetUserResult result= coreWebService.getUser(userId, locale, loadUserServiceAttributes, loadUserDeviceConfigurationServiceAttributes, loadUserResolvedGroups, loadUserResolvedGroupIds, loadUserGroups, loadUserWLANVPNVOIPConfigurations);
 
if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getGetUserReturnStatus().getMessage());
       return;
}
 
User user=result.getUser();
System.out.println("User ID: " + user.getUserId());
System.out.println("Display Name: " + user.getDisplayName());
 
//get the WLAN configuration
boolean includePolicyItems=true;
FindWLANConfigurationsResult WLANConfigurationsResult= coreWebService.findWLANConfigurations(locale, includePolicyItems);
if (WLANConfigurationsResult.getFindWLANConfigurationsReturnStatus().getCode()!= FindWLANConfigurationsReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + WLANConfigurationsResult.getFindWLANConfigurationsReturnStatus().getMessage());
       return;
}
 
//assign the first WLAN configuration found to the user
ITPolicy wlanConfig=null;
for (ITPolicy itr:WLANConfigurationsResult.getITPolicies()) {
       System.out.println("WLAN Config Name: " + itr.getPolicyName());
       wlanConfig=itr;
       break;
}
 
if (wlanConfig!=null) {
       //this user has only one device, therefore there is only one ITPolicyWLANVPNVOIPAttributes
       List <WLANConfigurations> wlanConfigs=user.getITPolicyWLANVPNVOIPAttributes().get(0).getWLANConfigurations();
       WLANConfigurations newWLANConfig=new WLANConfigurations();
       newWLANConfig.setWLANBaseConfigSetsId(wlanConfig.getPolicyId());
       newWLANConfig.setPolicyName(wlanConfig.getPolicyName());
       newWLANConfig.setOrganizationId(user.getOrganizationId());
       newWLANConfig.getLocaleNameAndDescription().addAll(wlanConfig.getLocaleNameAndDescription());
       newWLANConfig.setUserConfigId(user.getUserConfigId());
 
       wlanConfigs.add(newWLANConfig);
       
       SetUserResult setUserResult= coreWebService.setUser(user, locale);
       if (setUserResult.getSetUserReturnStatus().getCode() != SetUserReturnStatusEnumType.SUCCESS) {
               System.out.println("Error occurred: " + setUserResult.getSetUserReturnStatus().getMessage());
       }
 
}
                               
Permissions Required:
User and device -> Edit a user
User and device -> View a group AND User and device -> Edit a group OR Organizations -> View a group across organizations AND Organizations -> Edit a group across organizations

sendMessageToUser

SendMessageToUserResult sendMessageToUser(int userId,
                                          UserMessage message,
                                          BASEnumBaseDTO messageTypeEnum)
Sends a message to user.

Parameters:
userId - the ID of the user to send message to
message - the message containing subject and body to send to the user
messageTypeEnum - the message type. i.e. email, PIN, etc. Use enums named *MessageTypeEnum such as DispatcherMessageTypeEnum, EmailCommonMessageTypeEnum
Since:
5.0.0
Sample:

Java CXF

//Send PIN message
UserMessage message=new UserMessage();
DispatcherMessageTypeEnum messageType=new DispatcherMessageTypeEnum();
messageType.setEnum(DispatcherMessageTypeEnumType.PIN);
message.setSubject("subject");
message.setBody("message body");
SendMessageToUserResult result=coreWebService.sendMessageToUser(userId, message, messageType);
if (result.getSendMessageToUserReturnStatus().getCode()!= SendMessageToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getSendMessageToUserReturnStatus().getMessage());
}

                               

Java CXF

//Send Email message
UserMessage message=new UserMessage();
EmailCommonMessageTypeEnum messageType=new EmailCommonMessageTypeEnum();
messageType.setEnum(EmailCommonMessageTypeEnumType.EMAIL);
message.setSubject("subject");
message.setBody("message body");
SendMessageToUserResult result=coreWebService.sendMessageToUser(userId, message, messageType);
if (result.getSendMessageToUserReturnStatus().getCode()!= SendMessageToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getSendMessageToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR BlackBerry Administration Service setup -> Send message

getUser

GetUserResult getUser(int userId,
                      java.lang.String locale,
                      boolean loadUserServiceAttributes,
                      boolean loadUserDeviceConfigurationServiceAttributes,
                      boolean loadUserResolvedGroups,
                      boolean loadUserResolvedGroupIds,
                      boolean loadUserGroups,
                      boolean loadUserWLANVPNVOIPConfigurations)
Returns a user given a user ID.

Parameters:
userId - the userId to look for
locale - the locale of the returned data
loadUserServiceAttributes - load the userServiceAttributes property if set to true
loadUserDeviceConfigurationServiceAttributes - load the userDeviceConfigurationServiceAttributes property if set to true
loadUserResolvedGroups - load the ResolvedGroups property if set to true
loadUserResolvedGroupIds - load the ResolvedGroupIds property if set to true
loadUserGroups - load the UserGroups property if set to true
loadUserWLANVPNVOIPConfigurations - load the ITPolicyWLANVPNVOIPAttributes property if set to true
Returns:
User object containing details about the user
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean loadUserServiceAttributes=true;
boolean loadUserDeviceConfigurationServiceAttributes=true;
boolean loadUserResolvedGroups=true;
boolean loadUserResolvedGroupIds=true;
boolean loadUserGroups=true;
boolean loadUserWLANVPNVOIPConfigurations=true;
GetUserResult result= coreWebService.getUser(userId, locale, loadUserServiceAttributes, loadUserDeviceConfigurationServiceAttributes, loadUserResolvedGroups, loadUserResolvedGroupIds, loadUserGroups, loadUserWLANVPNVOIPConfigurations);
 
if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getGetUserReturnStatus().getMessage());
}
 
User user=result.getUser();
System.out.println("User ID: " + user.getUserId());
System.out.println("Login Name: " + user.getLoginName());
System.out.println("Display Name: " + user.getDisplayName());
for (UserServiceAttributesType itr:user.getUserServiceAttributes()) {
       if (itr instanceof EmailUserServiceAttributesType) {
               //get email stats
               GeneralEmailServiceUserStatistics emailStats=((EmailUserServiceAttributesType) itr).getGeneralEmailServiceUserStatistics();
               if (emailStats!=null) {
                       System.out.println("Total Messages Forwarded: " + emailStats.getTotalMessagesForwarded());
                       System.out.println("Total Messages Sent From Device: " + emailStats.getTotalMessagesSentFromDevice());
               }
       } else if (itr instanceof DispatcherUserServiceAttributesType) {
               System.out.println("Dispatcher name: " + ((DispatcherUserServiceAttributesType) itr).getDispatcherName());
       }
}
 
//print user assigned WLAN/VPN/VoIP configurations
for (ITPolicyWLANVPNVOIPAttributes itr:user.getITPolicyWLANVPNVOIPAttributes()) {
       for (WLANConfigurations itr2:itr.getWLANConfigurations()) {
               System.out.println("WLAN policy name:" + itr2.getPolicyName());
       }
 
       for (VPNConfigurations itr2:itr.getVPNConfigurations()) {
               System.out.println("VPN policy name:" + itr2.getPolicyName());
       }
 
       for (VOIPConfigurations itr2:itr.getVOIPConfigurations()) {
               System.out.println("VOIP policy name: " + itr2.getPolicyName());
       }
}
                               
Permissions Required:
Current user OR User and device -> View a group OR Organizations -> View a group across organizations
User and device -> View an IT policy

findSoftwareConfigurationApplications

FindSoftwareConfigurationApplicationsResult findSoftwareConfigurationApplications(ApplicationSearchCriteria searchCriteria,
                                                                                  ApplicationSearchResultSortByEnum sortBy,
                                                                                  boolean sortAscendingOrder,
                                                                                  java.lang.String locale,
                                                                                  SoftwareConfigurationApplicationData lastResultElement,
                                                                                  int pageSize)
finds available software configuration applications for a given search criteria.

Parameters:
searchCriteria - the application search criteria
sortBy - the sort order of the result
sortAscendingOrder - ascending if true, descending otherwise
locale - the locale to be used.
lastResultElement - the last SoftwareConfigurationApplicationData. used for retrieving the next page.
pageSize - the size of the paged results
Returns:
software configuration application(s) matching search criteria
Since:
5.0.0
Sample:

Java CXF

ApplicationSearchCriteria searchCriteria=new ApplicationSearchCriteria();
 
//set the sort order
ApplicationSearchResultSortByEnum sortByEnum=new ApplicationSearchResultSortByEnum();
sortByEnum.setEnum(ApplicationSearchResultSortByEnumType.APPLICATION_ID);
 
int pageSize=100;
String locale="en_US";
boolean sortAscending=true;
 
//call api passing in null as lastresult to get the first page
SoftwareConfigurationApplicationData lastResult=null;
FindSoftwareConfigurationApplicationsResult result=coreWebService.findSoftwareConfigurationApplications(searchCriteria, sortByEnum, sortAscending, locale, lastResult, pageSize);
 
//loop through pages
while (result.getFindSoftwareConfigurationApplicationsReturnStatus().getCode()== FindSoftwareConfigurationApplicationsReturnStatusEnumType.SUCCESS && result.getSoftwareConfigurationApplicationData()!=null) {
    List<SoftwareConfigurationApplicationData> softwareConfigurationApplicationDataList=result.getSoftwareConfigurationApplicationData();
    for (SoftwareConfigurationApplicationData itr:softwareConfigurationApplicationDataList) {
        System.out.println("Application Name: " + itr.getApplication().getApplicationAttributes().getLocaleNameAndDescription().get(0).getName());
        System.out.println("Application Version: " + itr.getApplication().getApplicationVersion());
        System.out.println("Application Delivery Mode: " + itr.getObjectDeliveryMode().value());
        System.out.println("Application Delivery Transport: " + itr.getObjectDeliveryTransport().value());
    }

    //fetch next page by passing in the last SoftwareConfigurationApplicationData object in the previous list
    lastResult=result.getSoftwareConfigurationApplicationData().get(result.getSoftwareConfigurationApplicationData().size()-1);
    result=coreWebService.findSoftwareConfigurationApplications(searchCriteria, sortByEnum, sortAscending, locale, lastResult, pageSize);

}

               
Permissions Required:
BlackBerry Administration Service setup -> View BlackBerry Administration Service software management

findServiceInstancesByServer

FindServiceInstancesByServerResult findServiceInstancesByServer(int serverId,
                                                                java.lang.String locale,
                                                                boolean includeStatus,
                                                                boolean includeExtendedData,
                                                                boolean loadServiceConsumerRelationships,
                                                                boolean loadServiceProducerRelationships)
Returns all service instances of a specified server. The data in the returned Server object is presented in the specified locale. Use boolean values to control what fields to return. For example, if you would like to know the status of the service instances, set boolean "includeStatus" to true, and the returned Service Instance object will have the status field set.

Parameters:
serverId - the ID of the Server. Use one of the findServer APIs to retrieve the Server Object.
locale - the Server object returned will contain data in this locale
includeStatus - if set to true, the Status field of the returned Service Instance will be set
includeExtendedData - if set to true, all plug-in related data will be set
loadServiceConsumerRelationships - if set to true, Service Consumer related fields will be set
loadServiceProducerRelationships - if set to true, Service Producer related fields will be set
Returns:
Service Instance objects matching the given Server ID. Any service instance object that does not have an associated windows service will have status of 'UNKNOWN'. This list includes: Email{platform}CoreServiceInstance, Email{platform}AgentServiceInstance, LoggingServiceInstance, AttachmentConnectorServiceInstance and RouterServiceInstance.
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean includeStatus=false;
boolean includeExtendedData=true;
boolean loadServiceConsumerRelationships=false;
boolean loadServiceProducerRelationships=false;
 
FindServiceInstancesByServerResult result=coreWebService.findServiceInstancesByServer(ID, locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
 
if (result.getFindServiceInstancesByServerReturnStatus().getCode()!= FindServiceInstancesByServerReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindServiceInstancesByServerReturnStatus().getMessage());
    return;
}
  
List < ServiceInstanceType> serviceInstances=result.getServiceInstances();
for (ServiceInstanceType itr:serviceInstances) {
         //cast to the subtypes if needed

         //print the name of the service instance
        System.out.println(itr.getName());
}

                               
Permissions Required:
Topology -> View an Instance

detachSoftwareConfigurationFromGroup

DetachSoftwareConfigurationFromGroupResult detachSoftwareConfigurationFromGroup(int groupId,
                                                                                int swconfigId)
Detaches a Software Configuration from a group.

Parameters:
groupId - the ID of the group to detach
swconfigId - the ID of the software configuration to detach group from
Since:
5.0.0
Sample:

Java CXF

DetachSoftwareConfigurationFromGroupResult result=coreWebService.detachSoftwareConfigurationFromGroup(groupId,swconfigId);
if (result.getDetachSoftwareConfigurationFromGroupReturnStatus().getCode()!= DetachSoftwareConfigurationFromGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getDetachSoftwareConfigurationFromGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

unassignVPNConfigurationFromUser

UnassignVPNConfigurationFromUserResult unassignVPNConfigurationFromUser(int vpnBaseConfigSetId,
                                                                        int userId)
Unassigns a VPN configuration from a user.

Parameters:
vpnBaseConfigSetId - the VPN configuration set ID to unassign
userId - the ID of the user to detach
Since:
5.0.0
Sample:

Java CXF

int userId=super.getValidUserID();
String locale="en_US";
boolean loadUserServiceAttributes=false;
boolean loadUserDeviceConfigurationServiceAttributes=false;
boolean loadUserResolvedGroups=false;
boolean loadUserResolvedGroupIds=false;
boolean loadUserGroups=false;
boolean loadUserWLANVPNVOIPConfigurations=true;
GetUserResult result= coreWebService.getUser(userId, locale, loadUserServiceAttributes, loadUserDeviceConfigurationServiceAttributes, loadUserResolvedGroups, loadUserResolvedGroupIds, loadUserGroups, loadUserWLANVPNVOIPConfigurations);
 
if (result.getGetUserReturnStatus().getCode() != GetUserReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + result.getGetUserReturnStatus().getMessage());
       return;
}
 
 
User user=result.getUser();
 
for (ITPolicyWLANVPNVOIPAttributes itr:user.getITPolicyWLANVPNVOIPAttributes()) {
       //detach the first VPN configuration from the user
       for (VPNConfigurations itr2:itr.getVPNConfigurations()) {
               System.out.println("Detaching VPN config:" + itr2.getPolicyName());
               int VPNConfigId=itr2.getWLANBaseConfigSetsId();
               UnassignVPNConfigurationFromUserResult detachResult= coreWebService.unassignVPNConfigurationFromUser(VPNConfigId, userId);
               if (detachResult.getUnassignVPNConfigurationFromUserReturnStatus().getCode() != UnassignVPNConfigurationFromUserReturnStatusEnumType.SUCCESS) {
                       System.out.println("Error occurred: " + detachResult.getUnassignVPNConfigurationFromUserReturnStatus().getMessage());
                       return;
               }
               break;
       }
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

createGroup

CreateGroupResult createGroup(int organizationId,
                              java.lang.String locale,
                              java.lang.String name,
                              java.lang.String description)
Creates a single native group.

Parameters:
organizationId - the group will be created in this organization
locale - the locale used when setting the name and description of the group
name - the group name
description - the localized description of the group
Returns:
the ID of the newly created group
Since:
5.0.0
Sample:

Java CXF

int organizationId=0;
String locale="en_US";
String name="group1";
String description="Group description";
 
CreateGroupResult result=coreWebService.createGroup(organizationId, locale, name, description);
 
if (result.getCreateGroupReturnStatus().getCode()!=CreateGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getCreateGroupReturnStatus().getMessage());
    return;
}
 
System.out.println("ID: " + result.getGroupId());

                               
Permissions Required:
User and device -> Create a group

createBASAuthenticatedAdministratorUser

CreateBASAuthenticatedAdministratorUserResult createBASAuthenticatedAdministratorUser(int organizationId,
                                                                                      java.lang.String displayName,
                                                                                      int roleId,
                                                                                      java.lang.String username,
                                                                                      java.lang.String password)
Creates a BAS authenticated administrator user.

Parameters:
organizationId - the Id of the organization. Use 0 for default.
displayName - the display name of the user
roleId - the Id of the role
username - the user name of the user
password - the password of the user
Returns:
the user ID of the newly created user
Since:
5.0.2
Sample:

Java CXF

int organizationId=0;
String displayName="Clyde Warren";
int roleId=1; // Security Administrator
String username="admin";
String password="password";

//call Create BAS Authenticated Administrator User
CreateBASAuthenticatedAdministratorUserResult createBASAuthenticatedAdministratorUserResult= 
    coreWebService.createBASAuthenticatedAdministratorUser(organizationId, displayName, roleId, username, password);
if (createBASAuthenticatedAdministratorUserResult.getCreateBASAuthenticatedAdministratorUserReturnStatus().getCode()!=
        CreateBASAuthenticatedAdministratorUserReturnStatusEnumType.SUCCESS) {
    System.out.println(createBASAuthenticatedAdministratorUserResult.getCreateBASAuthenticatedAdministratorUserReturnStatus().getMessage());
    return;
}

System.out.println("BAS Authenticated Administrator User added: id=" + createBASAuthenticatedAdministratorUserResult.getUserId());

         
Permissions Required:
User and device -> Create an administrator user

test

java.lang.String test(java.lang.String input)

attachITPolicyToGroup

AttachITPolicyToGroupResult attachITPolicyToGroup(int groupId,
                                                  int itpolicyId)
Attaches an IT Policy to a group.

Parameters:
groupId - the ID of the group to attach
itpolicyId - the ID of the IT Policy to attach group to
Since:
5.0.0
Sample:

Java CXF

AttachITPolicyToGroupResult result=coreWebService.attachITPolicyToGroup(groupId,itpolicyId);
if (result.getAttachITPolicyToGroupReturnStatus().getCode()!= AttachITPolicyToGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getAttachITPolicyToGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Add or remove to user configuration

killHandheld

KillHandheldResult killHandheld(int deviceId,
                                int delayTime,
                                boolean userOverride)
Erases data on handheld and disables it.

Parameters:
deviceId - the ID of the device to disable
delayTime - delay time in minutes to wait before killing handheld
userOverride - if set to true, the user can override this operation
Since:
5.0.0
Sample:

Java CXF

int deviceId=device.getDeviceId();
//time in minutes to delay the kill handheld command
int delayTime=60;
//the user cannot override this command
boolean userOverride=false;
KillHandheldResult killHandheldResult=coreWebService.killHandheld(deviceId, delayTime, userOverride);
if (killHandheldResult.getKillHandheldReturnStatus().getCode() != KillHandheldReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + killHandheldResult.getKillHandheldReturnStatus().getMessage());
}

                               
Permissions Required:
Device owner OR Organizations -> Edit a device across organizations OR User and device -> Edit a device

resendServiceBookToUser

ResendServiceBookToUserResult resendServiceBookToUser(int userId)
Resends service book for a user.

Parameters:
userId - the ID of the user to resend service book
Since:
5.0.0
Sample:

Java CXF

ResendServiceBookToUserResult result= coreWebService.resendServiceBookToUser(userId);
 
if (result.getResendServiceBookToUserReturnStatus().getCode()!= ResendServiceBookToUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getResendServiceBookToUserReturnStatus().getMessage());
}

                               
Permissions Required:
Current user OR Resend data to devices

findWLANConfigurations

FindWLANConfigurationsResult findWLANConfigurations(java.lang.String locale,
                                                    boolean includePolicyItems)
Returns all available WLAN configurations. The data in the returned ITPolicy object is presented in the specified locale.

Parameters:
locale - the ITPolicy object returned will contain data in this locale
includePolicyItems - if set to true, the ITPolicyItem field of the ITPolicy object will be set
Returns:
ITPolicy objects representing all WLAN Configurations
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean includePolicyItems=true;
FindWLANConfigurationsResult WLANConfigurationsResult= coreWebService.findWLANConfigurations(locale, includePolicyItems);
if (WLANConfigurationsResult.getFindWLANConfigurationsReturnStatus().getCode()!= FindWLANConfigurationsReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + WLANConfigurationsResult.getFindWLANConfigurationsReturnStatus().getMessage());
               return;
}
 
for (ITPolicy itr:WLANConfigurationsResult.getITPolicies()) {
       System.out.println("WLAN Config Name: " + itr.getPolicyName());            
}

                               
Permissions Required:
User and device -> View an IT Policy

createADAuthenticatedAdministratorUser

CreateADAuthenticatedAdministratorUserResult createADAuthenticatedAdministratorUser(int organizationId,
                                                                                    java.lang.String displayName,
                                                                                    int roleId,
                                                                                    java.lang.String username,
                                                                                    java.lang.String domain)
Creates an Active Directory authenticated administrator user.

Parameters:
organizationId - the Id of the organization. Use 0 for default.
displayName - the display name of the user
roleId - the Id of the role
username - the user name of the user
domain - the domain of the user
Returns:
the user ID of the newly created user
Since:
5.0.2
Sample:

Java CXF

int organizationId=0;
String displayName="Clyde Warren";
int roleId=1; // Security Administrator
String username="admin";
String domain="test.rim.net";

//call Create AD Authenticated Administrator User
CreateADAuthenticatedAdministratorUserResult createADAuthenticatedAdministratorUserResult=
    coreWebService.createADAuthenticatedAdministratorUser(organizationId, displayName, roleId, username, domain);
if (createADAuthenticatedAdministratorUserResult.getCreateADAuthenticatedAdministratorUserReturnStatus().getCode()!=
        CreateADAuthenticatedAdministratorUserReturnStatusEnumType.SUCCESS) {
    System.out.println(createADAuthenticatedAdministratorUserResult.getCreateADAuthenticatedAdministratorUserReturnStatus().getMessage());
    return;
}

System.out.println("AD Authenticated Administrator User added: id=" + createADAuthenticatedAdministratorUserResult.getUserId());

         
Permissions Required:
User and device -> Create an administrator user

moveUser

MoveUserResult moveUser(int userId,
                        UserMoveBlackBerryAttributes userMoveBlackBerryAttributes)
Moves a single BlackBerry Enabled user from one dispatcher instance to another.

Parameters:
userId - the ID of the user to move
userMoveBlackBerryAttributes - contains the destination service instance to move the user to
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
 
//find the service instance to move the user to, but first, we need to find the service, then the service instance
// set includeSettings to true in order to get plug-in related data back. This is needed to determine if the
// type is DispatcherService
boolean includeSettings=true;
FindServicesResult servicesResult= coreWebService.findServices(locale, includeSettings);
if (servicesResult.getFindServicesReturnStatus().getCode()!= FindServicesReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + servicesResult.getFindServicesReturnStatus().getMessage());
    return;
}

ServiceType dispatcherService=null;
for (ServiceType itr2:servicesResult.getServices()) {
    if (itr2 instanceof DispatcherService) {
        dispatcherService=itr2;
        break;
    }
}
 
if (dispatcherService==null) {
    System.out.println("Dispatcher Service not found");
    return;
}
 
// find the dispatcher instance on the server. this is needed for the serviceInstance
// and targetserviceInstance fields of the userMoveBlackBerryAttributes object
boolean includeStatus=false;
// this flag has to be set to true, or else none of the plug-in data will be loaded.
// this is needed in order to find the Dispatcher service instance
boolean includeExtendedData=true;
boolean loadServiceConsumerRelationships=false;
boolean loadServiceProducerRelationships=false;
FindServiceInstancesByServiceResult serviceInstanceResult= coreWebService.findServiceInstancesByService(dispatcherService.getServiceId(), locale, includeStatus, includeExtendedData, loadServiceConsumerRelationships, loadServiceProducerRelationships);
if (serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getCode()!= FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + serviceInstanceResult.getFindServiceInstancesByServiceReturnStatus().getMessage());
    return;
}
 
List<ServiceInstanceType> serviceInstances=serviceInstanceResult.getServiceInstances();
ServiceInstanceType targetDispatcherInstance=null;
for (ServiceInstanceType itr2:serviceInstances) {
    //find the Dispatcher instance by determining the type of the instance
    // the type should be DispatcherHostServiceInstance
    if (itr2 instanceof DispatcherHostServiceInstance) {
        //check to see if it is the dispatcher service instance you want by looking at the name
        if (itr2.getName().equalsIgnoreCase("server01")) {
            targetDispatcherInstance=itr2;
            break;
        }
    }
}
 
if (targetDispatcherInstance==null) {
    System.out.println("DispatcherHostInstance not found");
}
//create userMoveBlackBerryAttributes object needed for the createUser API.
UserMoveBlackBerryAttributes userMoveBBAttributes=new UserMoveBlackBerryAttributes();
 
//set the serviceInstance
userMoveBBAttributes.setServiceInstance(targetDispatcherInstance);
userMoveBBAttributes.setTargetServiceInstance(targetDispatcherInstance);
 
userMoveBBAttributes.setIgnoreDuplicateWarning(false);
userMoveBBAttributes.setIgnoreEncryptionWarning(false);
userMoveBBAttributes.setIgnoreInactiveTargetWarnings(false);
userMoveBBAttributes.setFailOutstandingJobs(false);
 
//call move user
MoveUserResult moveUserResult= coreWebService.moveUser(userId, userMoveBBAttributes);
if (moveUserResult.getMoveUserReturnStatus().getCode()!=MoveUserReturnStatusEnumType.SUCCESS) {
    System.out.println(moveUserResult.getMoveUserReturnStatus().getMessage());
}

               
Permissions Required:
User and device -> Edit a user

findITPolicyTemplateItems

FindITPolicyTemplateItemsResult findITPolicyTemplateItems(java.lang.String locale,
                                                          boolean includeUserDefinedTemplateItems)
Returns all available IT Policy template items in the system. The data in the returned ITPolicyTemplate object is presented in the specified locale.

Parameters:
locale - the ITPolicyTemplateItem object returned will contain data in this locale
includeUserDefinedTemplateItems - if set to true, user defined template items will also be included
Returns:
ITPolicyTemplateItem objects representing all IT Policy template items
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean includeUserDefinedTemplateItems=true;
FindITPolicyTemplateItemsResult findITPolicyTemplateItemsResult= coreWebService.findITPolicyTemplateItems(locale, includeUserDefinedTemplateItems);
if (findITPolicyTemplateItemsResult.getFindITPolicyTemplateItemsReturnStatus().getCode()!= FindITPolicyTemplateItemsReturnStatusEnumType.SUCCESS) {
       System.out.println("Error occurred: " + findITPolicyTemplateItemsResult.getFindITPolicyTemplateItemsReturnStatus().getMessage());
       return;
}
 
for (ITPolicyTemplateItem itr:findITPolicyTemplateItemsResult.getITPolicyTemplateItems()) {
       System.out.println("Name: " + itr.getName() + ", Type: " + itr.getType().value());
}

                               

cancelKillHandheld

CancelKillHandheldResult cancelKillHandheld(int deviceId)
Cancels a pending kill handheld command.

Parameters:
deviceId - the ID of the device to cancel pending kill command
Since:
5.0.0
Sample:

Java CXF

CancelKillHandheldResult cancelKillHandheldResult=coreWebService.cancelKillHandheld(deviceId);
if (cancelKillHandheldResult.getCancelKillHandheldReturnStatus().getCode() != CancelKillHandheldReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + cancelKillHandheldResult.getCancelKillHandheldReturnStatus().getMessage());
}

                               
Permissions Required:
Device owner OR Organizations -> Edit a device across organizations OR User and device -> Edit a device

findDeviceForUser

FindDeviceForUserResult findDeviceForUser(int userId,
                                          java.lang.String locale,
                                          boolean loadDeviceServiceAttributes)
Returns a BlackBerry device of a given user.

Parameters:
userId - the ID of the user to find a device for
locale - the locale to be used
loadDeviceServiceAttributes - flag that indicates whether or not to load the device service attributes
Returns:
Device object containing information about the BlackBerry device
Since:
5.0.0
Sample:

Java CXF

FindDeviceForUserResult result=coreWebService.findDeviceForUser(userId, locale, true);
if (result.getFindDeviceForUserReturnStatus().getCode()== FindDeviceForUserReturnStatusEnumType.SUCCESS
 && result.getDevice() != null) {
     Device device = result.getDevice();
 for (DeviceApplication itr:device.getDeviceApplication()){
     System.out.println(itr.getVersionStamps());
     System.out.println(itr.getName());
     System.out.println(itr.getVendor() + "\n");
 }
}
else{
     System.out.println(result.getFindDeviceForUserReturnStatus().getMessage());
 }
}
Permissions Required:
Device owner OR Organizations -> View a device across organizations OR User and device -> View a device

findResolvedUserCapabilities

FindResolvedUserCapabilitiesResult findResolvedUserCapabilities(int userId)
Returns resolved capabilities for a user.

Parameters:
userId - get resolved capabilities for user with this ID
Returns:
Capability objects representing the capabilities. Use findCapabilityDefinitions to retrieve definitions of the capabilities
Since:
5.0.0
Sample:

Java CXF

//get resolved capabilities
FindResolvedUserCapabilitiesResult findResolvedUserCapabilitiesResult= coreWebService.findResolvedUserCapabilities(userId);
if (findResolvedUserCapabilitiesResult.getFindResolvedUserCapabilitiesReturnStatus().getCode()!= FindResolvedUserCapabilitiesReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + findResolvedUserCapabilitiesResult.getFindResolvedUserCapabilitiesReturnStatus().getMessage());
    return;
}
 
//get the definition of the capabilities
FindCapabilityDefinitionsResult findapabilityDefinitionsResult= coreWebService.findCapabilityDefinitions(locale);
if (findCapabilityDefinitionsResult.getFindCapabilityDefinitionsReturnStatus().getCode()!= FindCapabilityDefinitionsReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + findCapabilityDefinitionsResult.getFindCapabilityDefinitionsReturnStatus().getMessage());
    return;
}
 
//loop through the resolved user capabilities, displaying the name of any capability definition with matching capability Id and plug-in Id
for (Capability itr:findResolvedUserCapabilitiesResult.getCapabilities()) {
    for (CapabilityDefinition itr2:findCapabilityDefinitionsResult.getCapabilityDefinitions()) {
        if (itr.getCapabilityId()==itr2.getCapabilityId() && itr.getPlugInId()==itr2.getPlugInId()) {
            System.out.println("Name: " + itr2.getName());
        }
    }
}

                               
Permissions Required:
BlackBerry Administration Service setup -> View a role
User and device -> View a user

addGroupToGroup

AddGroupToGroupResult addGroupToGroup(int destinationGroupId,
                                      int groupId)
Adds a group to a native group.

Parameters:
destinationGroupId - the ID of the destination group
groupId - the ID of the group
Since:
5.0.0
Sample:

Java CXF

AddGroupToGroupResult result=coreWebService.addGroupToGroup(destinationGroupId, groupId);
if (result.getAddGroupToGroupReturnStatus().getCode()!= AddGroupToGroupReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getAddGroupToGroupReturnStatus().getMessage());
    return;
}

                               
Permissions Required:
User and device -> Edit a group OR Organizations -> Edit a group across organizations

setDevicePassword

SetDevicePasswordResult setDevicePassword(int deviceId,
                                          java.lang.String devicePassword)
Sets the password for the specified device. The device is locked after setting the password.

Parameters:
deviceId - the ID of the device to set the password for
devicePassword - the password to use
Since:
5.0.0
Sample:

Java CXF

BASUserSearchResultServiceAttributesType BASAttributes=(BASUserSearchResultServiceAttributesType) attributes;                    
int deviceId=BASAttributes.getDeviceId();

SetDevicePasswordResult result=coreWebService.setDevicePassword(deviceId, "password");
if (result.getSetDevicePasswordReturnStatus().getCode()!= SetDevicePasswordReturnStatusEnumType.SUCCESS) {
 System.out.println("Error occurred: " + result.getSetDevicePasswordReturnStatus().getMessage());
}
 

                               
Permissions Required:
Device owner OR Organizations -> Edit a device across organizations OR User and device -> Edit a device

findSoftwareConfigurations

FindSoftwareConfigurationsResult findSoftwareConfigurations(java.lang.String locale,
                                                            boolean includeApplicationsData,
                                                            boolean includeOSConfiguration,
                                                            boolean includeApplicationControlPolicyMetaData,
                                                            boolean includeSoftwareConfigurationApplicationControlPolicyMetaData,
                                                            int organizationId)
Returns all software configurations in an organization. The data in the returned objects are presented in the specified locale.

Parameters:
locale - the Software Configuration object returned will contain data in this locale
includeApplicationsData - if set to true, the Application related fields will be set
includeOSConfiguration - if set to true, the OS configuration related fields will be set
includeApplicationControlPolicyMetaData - if set to true, the Application control Policy related fields will be set
includeSoftwareConfigurationApplicationControlPolicyMetaData - if set to true, the Application Control Policy metadata fields will be set
organizationId - the application control policy organization identifier
Returns:
SoftwareConfiguration objects representing all software configurations in the organization
Since:
5.0.0
Sample:

Java CXF

String locale="en_US";
boolean includeApplicationsData=false;
boolean includeOSConfiguration=false;
boolean includeApplicationControlPolicyMetaData=false;
boolean includeSoftwareConfigurationApplicationControlPolicyMetaData=false;
int organizationId=0;
 
FindSoftwareConfigurationsResult result=coreWebService.findSoftwareConfigurations(locale,includeApplicationsData,includeOSConfiguration,includeApplicationControlPolicyMetaData, includeSoftwareConfigurationApplicationControlPolicyMetaData, organizationId);
if (result.getFindSoftwareConfigurationsReturnStatus().getCode()!= FindSoftwareConfigurationsReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getFindSoftwareConfigurationsReturnStatus().getMessage());
    return;
}
 
for (SoftwareConfiguration itr:result.getSoftwareConfigurations()) {
    System.out.println("ID: " + itr.getSoftwareConfigId());
    System.out.println("Name: " + itr.getLocaleNameAndDescription().get(0).getName());
}

                               
Permissions Required:
BlackBerry Administration Service setup -> View BlackBerry Administration Service software management

disableBlackBerryUserAndDeleteUser

DisableBlackBerryUserAndDeleteUserResult disableBlackBerryUserAndDeleteUser(int userId,
                                                                            boolean removeMailboxInfo)
Disables BlackBerry Service for a single user and deletes the user.

Parameters:
userId - the Id of the user to disable and delete
removeMailboxInfo - flag that indicates whether or not to remove the mailbox information (also known as 'force hard delete')
Since:
5.0.1
Sample:

Java CXF

boolean removeMailboxInfo=false;
DisableBlackBerryUserAndDeleteUserResult result = coreWebService.disableBlackBerryUserAndDeleteUser(userId,removeMailboxInfo);
if (result.getDisableBlackBerryUserAndDeleteUserReturnStatus().getCode()!= DisableBlackBerryUserAndDeleteUserReturnStatusEnumType.SUCCESS) {
    System.out.println("Error occurred: " + result.getDisableBlackBerryUserAndDeleteUserReturnStatus().getMessage());
}
 

                               
Permissions Required:
User and device -> Delete a user

BlackBerry Administration API
v5.0.3.29

Copyright 2009 Research In Motion Limited. All Rights Reserved.