The Get User by Name operation returns the users in the system specified for the user ID specified in the URI

Request

The Get User by Name request may be specified as follows. Replace <user-id> with your user ID

Method Request URI HTTP Version

GET

https://admin-management.contoso.net/users/<user-id>

HTTP/1.1

URI Parameters

None.

Request Headers

The following table describes request headers.

Request Header Description

Authorization

Specifies the credentials for this request. The value of this header must be set Negotiate <token>.

Request Body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

The status code is embedded in the response for this operation; if successful, it will be status code 200 (OK).

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header Description

None

None

Response Body

The format of the response body is as follows:

  Copy Code



<User xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/windowsazure">
	<Name>test1@test.com</Name>
	<Email>test1@test.com</Email>
	<State>Active</State>
	<CreatedTime>2012-09-24T21:35:20.147</CreatedTime>
</User>

The following table describes the key elements of the response body:

Element Name

Description

Name

A name for the user

Email

The email address of the user

State

Whether the user is Active

Example

Get user by name.

  Copy Code
public User GetUserByName(string adminServiceEndpoint, string username)
{
	HttpClient httpClient = new HttpClient();
	httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("BASIC", Convert.ToBase64String(UnicodeEncoding.Unicode.GetBytes("AdminPortal:" + ”password”)))));

	string subscriptionEndpoint = adminServiceEndpoint + "users/" + username;
	var response = httpClient.GetAsync(subscriptionEndpoint);
	var resultsStr = response.Result.Content.ReadAsStringAsync().Result;
	var result = JsonConvert.DeserializeObject<User>(resultsStr);
	Console.WriteLine(resultsStr);
	return result;
}