/// <summary> /// Creates a device activation type that is of type BLACKBERRY_BALANCE. /// <returns>Returns a DeviceActivationType of type BLACKBERRY_BALANCE.</returns> /// </summary> public static DeviceActivationType createBlackBerryBalanceDeviceActivationType() { DeviceActivationType blackberryBalance = new DeviceActivationType(); blackberryBalance.BLACKBERRY_BALANCE = true; blackberryBalance.value = "BLACKBERRY_BALANCE"; return(blackberryBalance); }
/// <summary> /// The Main function. /// </summary> static int Main(string[] args) { startTime.Start(); // Return codes. const int success = 0; const int failure = 1; int returnCode = success; /* * Flags that are used to determine whether or not * CreateUser() and DisplayUserDetails() get called. */ bool createNewUser = false; bool displayUserDetails = true; // Hostname to use when connecting to web service. BWSHostName = "<BWSHostName>"; // e.g. BWSHostName = "server01.yourcompany.net". Username = "******"; // e.g. Username = "******". Password = "******"; // e.g. Password = "******". /* * Email address used to create a new user with the createUsers() API call. * This value must exactly match the full string value in the directory for successful user creation. */ CreateNewUserEmail = "\"[email protected]\""; // Email address used to identify the user to find with the getUsersDetail() API call. DisplayUserDetailsEmail = "\"[email protected]\""; /* * BWS Host certificate must be installed on the client machine before running this sample code, otherwise * a SSL/TLS secure channel error will be thrown. For more information, see the BlackBerry Web Services for * Enterprise Administration For Microsoft .NET Developers Getting Started Guide. */ try { logMessage("Initializing web services..."); if (Setup()) { /* * Demonstrate call to bwsService.getSystemInfo(). * This is also the first authenticated call in the client application. */ logMessage("Getting system information..."); if (GetSystemInfo()) { if (createNewUser) { /* * If the default device activation type property exists in the domain, then it means * that NewUser.setActivationTypeForNewAndReactivatedDevices is supported. */ if (DefaultDeviceActivationTypeExists) { // Device activation type used to create a new user with the createUsers() API call. CreateNewUserDeviceActivationType = createBlackBerryBalanceDeviceActivationType(); } logMessage("Creating a user..."); // Demonstrate call to bwsService.createUsers() API. if (!CreateUser()) { logMessage("Error: CreateUser() failed"); returnCode = failure; } } if (displayUserDetails) { logMessage("Displaying a user's details..."); // Demonstrate call to bwsService.getUsers() and bwsService.getUsersDetail() APIs. if (!DisplayUserDetails()) { logMessage("Error: DisplayUserDetails() failed"); returnCode = failure; } } } else { logMessage("Error: GetSystemInfo() failed"); returnCode = failure; } } else { logMessage("Error: Setup() failed"); returnCode = failure; } } catch (Exception e) { Console.Error.WriteLine("Exception: \"{0}\"", e.Message); returnCode = failure; } Console.Error.WriteLine("Press Enter to exit"); Console.ReadKey(); return(returnCode); }
private static string Username = null; // e.g. Username = "******". #endregion Fields #region Methods /// <summary> /// Creates a device activation type that is of type BLACKBERRY_BALANCE. /// <returns>Returns a DeviceActivationType of type BLACKBERRY_BALANCE.</returns> /// </summary> public static DeviceActivationType createBlackBerryBalanceDeviceActivationType() { DeviceActivationType blackberryBalance = new DeviceActivationType(); blackberryBalance.BLACKBERRY_BALANCE = true; blackberryBalance.value = "BLACKBERRY_BALANCE"; return blackberryBalance; }
/// <summary> /// The Main function. /// </summary> static int Main(string[] args) { startTime.Start(); // Return codes. const int success = 0; const int failure = 1; int returnCode = success; /* * Flags that are used to determine whether or not * CreateUser() and DisplayUserDetails() get called. */ bool createNewUser = false; bool displayUserDetails = true; // Hostname to use when connecting to web service. BWSHostName = "<BWSHostName>"; // e.g. BWSHostName = "server01.yourcompany.net". Username = "******"; // e.g. Username = "******". Password = "******"; // e.g. Password = "******". /* * Email address used to create a new user with the createUsers() API call. * This value must exactly match the full string value in the directory for successful user creation. */ CreateNewUserEmail = "\"[email protected]\""; // Email address used to identify the user to find with the getUsersDetail() API call. DisplayUserDetailsEmail = "\"[email protected]\""; /* * BWS Host certificate must be installed on the client machine before running this sample code, otherwise * a SSL/TLS secure channel error will be thrown. For more information, see the BlackBerry Web Services for * Enterprise Administration For Microsoft .NET Developers Getting Started Guide. */ try { logMessage("Initializing web services..."); if (Setup()) { /* * Demonstrate call to bwsService.getSystemInfo(). * This is also the first authenticated call in the client application. */ logMessage("Getting system information..."); if (GetSystemInfo()) { if (createNewUser) { /* * If the default device activation type property exists in the domain, then it means * that NewUser.setActivationTypeForNewAndReactivatedDevices is supported. */ if (DefaultDeviceActivationTypeExists) { // Device activation type used to create a new user with the createUsers() API call. CreateNewUserDeviceActivationType = createBlackBerryBalanceDeviceActivationType(); } logMessage("Creating a user..."); // Demonstrate call to bwsService.createUsers() API. if (!CreateUser()) { logMessage("Error: CreateUser() failed"); returnCode = failure; } } if (displayUserDetails) { logMessage("Displaying a user's details..."); // Demonstrate call to bwsService.getUsers() and bwsService.getUsersDetail() APIs. if (!DisplayUserDetails()) { logMessage("Error: DisplayUserDetails() failed"); returnCode = failure; } } } else { logMessage("Error: GetSystemInfo() failed"); returnCode = failure; } } else { logMessage("Error: Setup() failed"); returnCode = failure; } } catch (Exception e) { Console.Error.WriteLine("Exception: \"{0}\"", e.Message); returnCode = failure; } Console.Error.WriteLine("Press Enter to exit"); Console.ReadKey(); return returnCode; }