GWS Application: Part 2
Let's ask Groove for a list of accounts, identities, and workspaces, and display them in our form.
A groove account contains one or more identities, which are alternate names for the same user. You can create multiple identities, to appear with different names in different workspaces. (This is one of Groove's very-little-used features; I don't know anyone who actually uses multiple identities regularly. But it means that your workspaces are each tied to the identity, not the account).
Having added the GWS web references to our project, it's quite easy to ask Groove for the list of accounts, which returns an array including the list of identities for each account:
// Create an instance of the GrooveAccounts web service proxy class to call Groove
GrooveAccounts accountsService = new GrooveAccounts();
accountsService.GrooveRequestHeaderValue = new GrooveAccountsWebService.GrooveRequestHeader();
accountsService.GrooveRequestHeaderValue.GrooveRequestKey = "SECRET KEY GOES HERE";
accountsService.Url = "http://localhost:9080/GWS/Groove/2.0/Accounts";
// Read the list of Groove accounts
Account[] accounts = accountsService.Read();
foreach( Account a in accounts )
{
foreach( Identity i in a.Identities )
{
// Do something with the identity (display it in a combobox, for example).
}
}
One of the properties on the Identity i is Spaces, which is a string: the URL of the Spaces web service, which we can call to read the list of workspaces for this identity (and to create new workspaces, rename, export spaces as archive, and so on).

Two problems with the code so far. First, there's a secret key we don't know about; second, that URL is hard-coded to port 9080, and that's not a safe assumption (the port may change). Now, I only want to do this once, but it'll take a whole post to cover properly. Up next.