使用ActiveX的Outlook约会

时间:2019-11-15 09:02:31

标签: javascript outlook outlook-addin

我想使用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();

1 个答案:

答案 0 :(得分:0)

您将需要从Application.Iimezones集合中检索时区。我从来没有碰到过按名称获取tz的运气,因此您需要枚举时区并检查其ID / Name / StandardDesignation / DaylightDesignation属性。 / p>