AutodiscoverService.GetUserSettings(String, UserSettingName[]) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves the specified user settings for an SMTP address.
public:
Microsoft::Exchange::WebServices::Autodiscover::GetUserSettingsResponse ^ GetUserSettings(System::String ^ userSmtpAddress, ... cli::array <Microsoft::Exchange::WebServices::Autodiscover::UserSettingName> ^ userSettingNames);
public Microsoft.Exchange.WebServices.Autodiscover.GetUserSettingsResponse GetUserSettings (string userSmtpAddress, params Microsoft.Exchange.WebServices.Autodiscover.UserSettingName[] userSettingNames);
Public Function GetUserSettings (userSmtpAddress As String, ParamArray userSettingNames As UserSettingName()) As GetUserSettingsResponse
Parameters
- userSmtpAddress
- String
The SMTP address of the user.
- userSettingNames
- UserSettingName[]
The user setting names.
Returns
The requested settings for the specified user.
Examples
The following code example shows how to use the GetUserSettings(String, UserSettingName[]) method to retrieve the UserDisplayName, CasVersion, and other user settings requested in the userSettingNames
parameter. The user setting name and value are displayed.
public static GetUserSettingsResponse GetUserSettings(
AutodiscoverService service,
string emailAddress,
int maxHops,
params UserSettingName[] settings)
{
Uri url = null;
GetUserSettingsResponse response = null;
for (int attempt = 0; attempt < maxHops; attempt++)
{
service.Url = url;
service.EnableScpLookup = (attempt < 2);
response = service.GetUserSettings(emailAddress, settings);
if (response.ErrorCode == AutodiscoverErrorCode.RedirectAddress)
{
url = new Uri(response.RedirectTarget);
}
else if (response.ErrorCode == AutodiscoverErrorCode.RedirectUrl)
{
url = new Uri(response.RedirectTarget);
}
else
{
return response;
}
}
throw new Exception("No suitable Autodiscover endpoint was found.");
}
Remarks
The GetUserSettings(String, UserSettingName[]) method does not follow address and URL redirections. Only the requested user settings are retrieved, if they exist.