This documentation is archived and is not being maintained.

SetUserOofSettingsRequest Class

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


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

No code example is currently available or this language may not be supported.

The SetUserOofSettings Operation can be used to set both the internal and external OOF settings.

The following example shows you how to set the internal and external OOF settings for an Exchange mailbox.

static void SetOOF()
    // Identify the service and the user.
    ExchangeServiceBinding service = new ExchangeServiceBinding();
    service.Credentials = new NetworkCredential("UserName", "PassWord", "Domain");
    service.Url = @"";

    // Identify the user mailbox for which to set OOF information.
    EmailAddress emailAddress = new EmailAddress();

    emailAddress.Address = "";

    UserOofSettings OOFSettings = new UserOofSettings();

    // Identify the time that a user is OOF. 
    Duration duration = new Duration();
    duration.StartTime = DateTime.Now;
    duration.EndTime = DateTime.Now.AddHours(4);
    OOFSettings.Duration = duration;

    // Identify the external audience.
    OOFSettings.ExternalAudience = ExternalAudience.Known;

    // Create the reply messages.
    ReplyBody internalReply = new ReplyBody();
    ReplyBody externalReply = new ReplyBody();
    externalReply.Message = "This is my external OOF reply";
    internalReply.Message = "This is my internal OOF reply";

    OOFSettings.ExternalReply = externalReply;
    OOFSettings.InternalReply = internalReply;

    // Set OOF state.
    OOFSettings.OofState = OofState.Enabled;

    // Create the request.
    SetUserOofSettingsRequest request = new SetUserOofSettingsRequest();
    request.Mailbox = emailAddress;
    request.UserOofSettings = OOFSettings;

        // Send the request and return the response.
        SetUserOofSettingsResponse response = service.SetUserOofSettings(request);
    catch (Exception e)

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