The Get User Setting by Name operation returns the specified user setting in the system as a user setting object, for the user ID specified in the URI

Request

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

Method Request URI HTTP Version

GET

https://tenant-management.contoso.net/users/<user-id>/settings/<setting-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

  Copy Code

<SettingBatch xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Microsoft.WindowsAzure.Management.Setting.Client.DataContracts">
   <Method>Get</Method>
   <SettingCollection>
	<Setting>
		 <ExpirationInDays i:nil="true" />
		 <Name>Some Setting Name</Name>
		 <Path>Some path</Path>
		 <Value>ABC</Value>
	</Setting>
   </SettingCollection>
   <SettingStoreId>
	<Id>user@contoso.com</Id>
	<Store>Some store</Store>
	<Type>User</Type>
   </SettingStoreId>
</SettingBatch>

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

<SettingCollection xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Microsoft.WindowsAzure.Management.Setting.Client.DataContracts">
   <Setting>
	<ExpirationInDays i:nil="true" />
	<Name>Some Setting Name</Name>
	<Path>Some Path</Path>
	<Value>ABC</Value>
   </Setting>
</SettingCollection>


Example

Get user setting by name.

  Copy Code
public void GetUserSetting(string tenantServiceEndpoint)
{
	HttpClient httpClient = new HttpClient();
	httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("BASIC", Convert.ToBase64String(UnicodeEncoding.Unicode.GetBytes("TenantPortal:" + ”password”)))));

	string subscriptionEndpoint = tenantServiceEndpoint + "settings/";
	var settingStoreId = new SettingStoreId("Global", "User", "test@test.com");
	var setting = new Setting()
	{
		Path = "some path",
		/* This parameter can be modified to get all settings in a particular path.
		 If the name is mentioned, it will return the setting in the specified path
		 with the specified name; otherwise it gets ALL settings in the specified path*/
		Name = "setting name",
};
	var settingCollection = new SettingCollection { setting };
	var batch = new SettingBatch(settingStoreId, settingCollection, SettingMethods.Get);

	Console.WriteLine((httpClient.PostAsXmlAsync<SettingBatch>(subscriptionEndpoint, batch).Result.Content.ReadAsStringAsync().Result));
}