SetUserOofSettingsRequest Class
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.
The SetUserOofSettingsRequest class represents a request to set a user's Out of Office (OOF) settings.
public ref class SetUserOofSettingsRequest : ExchangeWebServices::BaseRequestType
public class SetUserOofSettingsRequest : ExchangeWebServices.BaseRequestType
Public Class SetUserOofSettingsRequest
Inherits BaseRequestType
- Inheritance
Examples
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 <span class="label">request</span> = new SetUserOofSettingsRequest();
<span class="label">request</span>.Mailbox = emailAddress;
<span class="label">request</span>.UserOofSettings = OOFSettings;
try
{
// Send the request and return the response.
SetUserOofSettingsResponse response = service.SetUserOofSettings(<span class="label">request</span>);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
Remarks
The SetUserOofSettings operation can be used to set both the internal and external OOF settings.
Constructors
SetUserOofSettingsRequest() |
The SetUserOofSettingsRequest constructor initializes a new instance of the SetUserOofSettingsRequest class. |
Properties
Mailbox |
The Mailbox property gets or sets the mailbox user who will have the updated Out of Office (OOF) settings. This property is required. This is a read/write property. |
UserOofSettings |
The UserOofSettings property gets or sets the Out of Office (OOF) settings of a mailbox user. This property is required. This is a read/write property. |