使用ActiveX的Outlook约会



我想使用ActiveX设置outlook约会。

以下代码正在工作。除了我设置时区的部分。我似乎找不到如何设置。是否有任何API参考可用于设置时区?

var sub = "Test";
var stDate = "01-01-2020";
var endDate = "01-01-2020";
var sBody1 = ".....";
var sBody2 = "hello ";
var sBody3 = ".....world";
if (confirm("Are you sure that you want to send an outlook invite for the meeting? Click OK to send invite.")) {
try {
outlookApp = new ActiveXObject("outlook.application");
}
catch (Error) {
alert("Please verify if your browser is enabled to run ActiveX scripts and try again!");
return false;
}
try {
nameSpace = outlookApp.getNameSpace("MAPI");
mailFolder = nameSpace.getDefaultFolder(6);
mailItem = mailFolder.Items.Add("IPM.Appointment.ConfRmReq");
mailItem.MeetingStatus = 1;
mailItem.Subject = sub;
mailItem.Start = stDate;
mailItem.End = endDate;
mailItem.TimeZones = ["Eastern Standard Time"];
//var tzEastern = tzs["Eastern Standard Time"];
mailItem.StartTimeZone = tzEastern;
mailItem.EndTimeZone = tzEastern;
var sBody = sBody1;
mailItem.Body = sBody;
sEmailList.push('Email Address');
mailItem.RequiredAttendees = sEmailList.join(';');
mailItem.Display();

您需要从Application.Iimezones集合中检索时区。我从来没有通过名称检索到tz,所以您需要枚举时区并检查它们的ID/Name/StandardDesignation/DaylightDesignation属性。

最新更新