EWSOofUtil Reference and Samples Page
SetOof(string EmailAddress, string OofStatus, string InternalMessage, string ExternalMessage, DateTime DurationStartTime,DateTime DurationEndTime, string InternalMessageLanguage, string ExternalMessageLanguage, string ExternalAudienceSetting, string UserName, string Password,string Domain, string OofURL)
Mandatory parameters
Emailaddress (well pretty self explanatory)
OofStatus
(Enabled,Disable,Scheduled)
Optionals
InternalMessage Text/Html of the Internal OofMessage
ExternalMessage Text/Html of the
Enternal OofMessage
DurationStartTime
DateTime Start of Scheuduled Oof (use UTC Time)
DurationEndTime EndTime End of Scheuduled Oof
InternalMessageLanguage
XML Language Setting of Internal OofMessage
ExternalMessageLanguage XML Language Setting of External OofMessage
ExternalAudienceSetting
(All,None,Know)
UserName Username to
connect to EWS with
Password password to connect to EWS with
Domain domain for Username
OofURL String for Cas
server eg (“https://servername/EWS/Exchange.asmx”)
Powershell Usage
To use the code from Powershell you first need to load the DLL in Powershell you use the following line.
[Reflection.Assembly]::LoadFile("c:\temp\EWSOofUtil.dll")
Without specifying authentication (the script will use the currently logged on credentials and then search Active Directory for the a Service Connection Point and do a autodiscovery request to retrieve URL to make the Oofrequest)
[Reflection.Assembly]::LoadFile("c:\EWSOofUtil.dll")
$oofutil = new-object EWSOofUtil.OofUtil
$oofutil.getoof("user@e2007dev.domain”,
“Enabled”)
Setting the Oof Messages to Scheduled for a period of a week
[Reflection.Assembly]::LoadFile("c:\EWSOofUtil.dll")
$oofutil = new-object EWSOofUtil.OofUtil
$oofutil.setoof("user@e2007dev.domain","Scheduled",
[datetime]::Now.Date.ToUniversalTime(),[datetime]::Now.Date.AddDays(7).ToUniversalTime())
Complex Message Sample
[Reflection.Assembly]::LoadFile("c:\EWSOofUtil.dll")
$oofutil = new-object EWSOofUtil.OofUtil
$ExternalMessage = "<font
color=`"#99CC00`">I will be out of the office from the 28-Jan to
the" +
"29-Jan if you have any problem please use </font>" +
"<a href=`"http://www.google.com`">google</a>
"
$oofutil.setoof("user108@domain.com","Enabled","",$ExternalMessage)
Specifying a Username, Password and Cas server samples
[Reflection.Assembly]::LoadFile("c:\EWSOofUtil.dll")
$oofutil = new-object EWSOofUtil.OofUtil
$oofutil.setoof("user@domain.com","Enabled","Im
out of the office”
,"","userName","password","domain","https://servername/EWS/Exchange.asmx")
[Reflection.Assembly]::LoadFile("c:\EWSOofUtil.dll")
$oofutil = new-object EWSOofUtil.OofUtil
$oofutil.setoof("user@domain.com","Scheduled”,
[datetime]::Now.Date.ToUniversalTime(),[datetime]::Now.Date.AddDays(7).ToUniversalTime(),"userName","password","domain","https://servername/EWS/Exchange.asmx")
C#
Samples
Simple
OofUtil oof = new
OofUtil();
oof.SetOof(
res
= oof1.SetOof("user@domain.com", "enabled");
Set
Scheduled
OofUtil oof = new
OofUtil();
res
= oof.SetOof("User108@domain.com",
"Scheduled",DateTime.Now.ToUniversalTime(),DateTime.Now.AddDays(7).ToUniversalTime());
Complex
Message Sample
string ExternalMessage = "<font color=\"#99CC00\">I will be
out of the office from the 12-Jan to the" +
"19
Jan if you have any problem please use </font>" +
"<a
href=\"http://www.google.com/\">google</a> ";
string res = "";
string InternalMessage = "<font color=\"#99CC00\">I will be
out of the office from the 12-Jan to the" +
"19
Jan if you have any problem please phone 3333-11123";
OofUtil oof = new
OofUtil();
res
= oof.SetOof("User108@domain.com",
"Enabled", InternalMessage, "", "known");
Complex
Message Sample
OofUtil oof = new
OofUtil();
res
= oof.SetOof("User108@domain.com",
"Enabled", “Username", "password",
"domain", "https://servername/EWS/Exchange.asmx");