我在将此 VB6 代码转换为 VBScript 时遇到问题。我正在调用一个 COM 对象来创建一个数组作为 EmailAddressType。这是工作的 VB6 代码:
'Assign TO: addresses
Dim toAdresses(2) As New EmailAddressType
toAdresses(0).EmailAddress = "someone@whocares.com"
toAdresses(0).RoutingType = "SMTP"
toAdresses(1).EmailAddress = "someoneelse@whocares.com"
toAdresses(1).RoutingType = "SMTP"
email.ToRecipients = toAdresses
我似乎无法弄清楚如何将其转换为 VBScript。我已经尝试了以下方法,但是一旦我收到电子邮件就会收到类型不匹配错误。ToRecipients = toAdresses
'Assign TO: addresses
dim toAdresses(2)
set toAdresses(0) = createobject("EWS.EWSWebSvc.EmailAddressType")
set toAdresses(1) = createobject("EWS.EWSWebSvc.EmailAddressType")
toAdresses(0).EmailAddress = "someone@whocares.com"
toAdresses(0).RoutingType = "SMTP"
toAdresses(1).EmailAddress = "someoneelse@whocares.com"
toAdresses(1).RoutingType = "SMTP"
email.ToRecipients = toAdresses
顺便说一句,这是 Exchange Web 服务的 COM 包装器,如果有帮助的话。