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)

Syntax

'Declaration
<SerializableAttribute> _
<XmlTypeAttribute(Namespace:="https://schemas.microsoft.com/exchange/services/2006/messages")> _
<GeneratedCodeAttribute("wsdl", "2.0.50727.42")> _
<DebuggerStepThroughAttribute> _
<DesignerCategoryAttribute("code")> _
Public Class SetUserOofSettingsRequest
    Inherits BaseRequestType
[SerializableAttribute] 
[XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages")] 
[GeneratedCodeAttribute("wsdl", "2.0.50727.42")] 
[DebuggerStepThroughAttribute] 
[DesignerCategoryAttribute("code")] 
public class SetUserOofSettingsRequest : BaseRequestType
[SerializableAttribute] 
[XmlTypeAttribute(Namespace=L"https://schemas.microsoft.com/exchange/services/2006/messages")] 
[GeneratedCodeAttribute(L"wsdl", L"2.0.50727.42")] 
[DebuggerStepThroughAttribute] 
[DesignerCategoryAttribute(L"code")] 
public ref class SetUserOofSettingsRequest : public BaseRequestType
/** @attribute SerializableAttribute() */ 
/** @attribute XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") */ 
/** @attribute GeneratedCodeAttribute("wsdl", "2.0.50727.42") */ 
/** @attribute DebuggerStepThroughAttribute() */ 
/** @attribute DesignerCategoryAttribute("code") */ 
public class SetUserOofSettingsRequest extends BaseRequestType
SerializableAttribute 
XmlTypeAttribute(Namespace="https://schemas.microsoft.com/exchange/services/2006/messages") 
GeneratedCodeAttribute("wsdl", "2.0.50727.42") 
DebuggerStepThroughAttribute 
DesignerCategoryAttribute("code") 
public class SetUserOofSettingsRequest extends BaseRequestType

Remarks

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

Inheritance Hierarchy

System.Object
   ExchangeWebServices.BaseRequestType
    ExchangeWebServices.SetUserOofSettingsRequest

Example

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 = @"http://exchangeserver.example.com/EWS/Exchange.asmx";

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

    emailAddress.Address = "donhall@example.com";

    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;

    try
    {
        // Send the request and return the response.
        SetUserOofSettingsResponse response = service.SetUserOofSettings(request);
    }
    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.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,

Target Platforms

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)