Поделиться через


GetUserOofSettingsRequest Class

The GetUserOofSettingsRequest class represents a request to get a user's Out of Office (OOF) settings.

Inheritance Hierarchy

System.Object
  ExchangeWebServices.BaseRequestType
    ExchangeWebServices.GetUserOofSettingsRequest

Namespace:  ExchangeWebServices
Assembly:  EWS (in EWS.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class GetUserOofSettingsRequest _
    Inherits BaseRequestType
'Usage
Dim instance As GetUserOofSettingsRequest
[SerializableAttribute]
public class GetUserOofSettingsRequest : BaseRequestType

Remarks

If the OOF message is set by Microsoft Office Outlook, this operation will return the OOF message in HTML format.

Examples

The following example shows you how to form a GetUserOofSettings request and receive the response.

static void GetOOF(ExchangeServiceBinding esb)
{
    // Create the request.
    GetUserOofSettingsRequest request = new GetUserOofSettingsRequest();
    request.Mailbox = new EmailAddress();
    request.Mailbox.Address = "someone@example.com";

    try
    {
        // Send the request and get the response.
        GetUserOofSettingsResponse response = esb.GetUserOofSettings(request);
        if (response.ResponseMessage.ResponseClass == ResponseClassType.Success)
        {
            if (response.AllowExternalOofSpecified)
            {
                Console.WriteLine("External OOF enabled for: " + response.AllowExternalOof);
            }

            // Display OOF information.
            Duration dur = response.OofSettings.Duration;
            Console.WriteLine("OOF start time: " + dur.StartTime.ToString());
            Console.WriteLine("OOF end time: " + dur.EndTime.ToString());

            Console.WriteLine("OOF state: " + response.OofSettings.OofState);
            Console.WriteLine("External reply: " + response.OofSettings.ExternalReply.Message);
            Console.WriteLine("Internal reply: " + response.OofSettings.InternalReply.Message);
        }
    }
    catch (Exception e)
    { 
        Console.WriteLine(e.Message); 
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.