Google Apps Security and Compliance Services Web Services Application Programming Interface Guide, Early Access Version 1.5 User Manual

Page 31

Advertising
background image

Endpoint Resolver

29

C# Example

This v.1.5 C# example is using the PMP password (pword) for authentication.
The snippet example was created using Microsoft Visual Studio 2005.

try

{

//Create an instance of AutomatedBatch Reference

AutomatedBatchAPI.AutomatedBatchService wsAddUser = new

AutomatedBatchAPI.AutomatedBatchService();

//Create an Instance of the authElement

AutomatedBatchAPI.authElem authCredentials = new

AutomatedBatchAPI.authElem();

//Get the email address and password entered by the user Use the

xauth method instead of pword if the authentication is XAuth

authCredentials.apiKey = “<your application’s unique license key>”;

authCredentials.email = "<email address entered by the user>";

authCredentials.pword = "<password entered by the user>";

// Retrieve the endpoint for the specified auth email and service,

setting it for our Automated Batch service.

wsAddUser.Url = new

EndpointResolverAPI.EndpointResolverService().GetServiceEndpoint("<a

piKey>",authCredentials.email,EndpointResolverAPI.service.v2Automate

dBatch);

//Create an instance of the extra argument structure for adduser

AutomatedBatchAPI.adduserargs userExtraArgs = new

AutomatedBatchAPI.adduserargs();

//adduser arguments are user address, fields, org, and welcome

userExtraArgs.org = "<org name entered by user>";

//welcome message to users upon account creation

userExtraArgs.welcome = "<welcome flag entered by the user>";

//user address

String userAddress = "<user address entered by the user>";

//AddUser Web Service request

wsAddUser.adduser(authCredentials, userAddress, userExtraArgs);

Advertising