PropertyAccessor是否在VBScript中工作?

PropertyAccessor是否在VBScript中工作?,vbscript,outlook,Vbscript,Outlook,我不能让它工作。每当我将VBScript与.PropertyAccessor一起使用时,都会出现一个错误。“Ojbect不支持此属性或方法:'PropertyAccessor'-代码:800A01B6” Const PR\u ATTACH\u MIME\u TAG=”http://schemas.microsoft.com/mapi/proptag/0x370E001E" Const PR_ATTACH_CONTENT_ID=”http://schemas.microsoft.com/mapi/

我不能让它工作。每当我将VBScript与.PropertyAccessor一起使用时,都会出现一个错误。“Ojbect不支持此属性或方法:'PropertyAccessor'-代码:800A01B6”

Const PR\u ATTACH\u MIME\u TAG=”http://schemas.microsoft.com/mapi/proptag/0x370E001E"
Const PR_ATTACH_CONTENT_ID=”http://schemas.microsoft.com/mapi/proptag/0x3712001E"
Const PR_附件_隐藏=”http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"
模糊地址
Dim FromAddress
模糊信息主题
昏暗的我的时间
模糊消息体
Dim消息附件
Dim ol、ns、newMail
模糊真实附件
MyTime=现在
地址=”testing@address.com"
MessageSubject=“自动统计”和MyTime
MessageBody=“Stats Attached”&vbCrLf&“在”&MyTime生成”
MessageAttachment=“f:\test\LOGO.jpg”
设置Outlook=CreateObject(“Outlook.Application”)
设置ns=Outlook.GetNamespace(“MAPI”)
设置newMail=Outlook.CreateItem(olMailItem)
newMail.Subject=MessageSubject
newMail.Body=MessageBody
newMail.Recipients.Add(ToAddress)
Set realAttachment=newMail.Attachments.Add(MessageAttachment)
设置oPA=realAttachment.PropertyAccessor
oPA.SetProperty PR_ATTACH_MIME_标记,“image/jpeg”
oPA.SetProperty PR_ATTACH_CONTENT_ID,“myident”更改其他图像的myident
newMail.HTMLBody=newMail.HTMLBody&''需要匹配上面的“MyIdentit”
newMail.Display
新邮件,发送

您使用的Outlook版本是什么?PropertyAccessor是在Outlook 2007中添加的。+Dmitry Streblechenko-就是这样,我的开发系统安装了Outlook 2003,并不断产生错误。一旦我在Outlook 2016上测试了完全相同的脚本,它就工作得非常好。感谢您的快速响应和解决方案。
Const PR_ATTACH_MIME_TAG = "http://schemas.microsoft.com/mapi/proptag/0x370E001E"
Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
Const PR_ATTACHMENT_HIDDEN = "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"



Dim ToAddress
Dim FromAddress
Dim MessageSubject
Dim MyTime
Dim MessageBody
Dim MessageAttachment
Dim ol, ns, newMail
Dim realAttachment
MyTime = Now

ToAddress = "testing@address.com"
MessageSubject = "Auto Stats " & MyTime
MessageBody = "Stats Attached" & vbCrLf & "Produced at " & MyTime
MessageAttachment = "f:\test\LOGO.jpg"
Set Outlook = CreateObject("Outlook.Application")
Set ns = Outlook.GetNamespace("MAPI")
Set newMail = Outlook.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody
newMail.Recipients.Add (ToAddress)
Set realAttachment = newMail.Attachments.Add(MessageAttachment)
Set oPA = realAttachment.PropertyAccessor
oPA.SetProperty PR_ATTACH_MIME_TAG, "image/jpeg"
oPA.SetProperty PR_ATTACH_CONTENT_ID, "myident" 'change myident for another other image
newMail.HTMLBody = newMail.HTMLBody & "<IMG align=baseline border=0 hspace=0 src=cid:myident>" 'need to match the "myident" above
newMail.Display
newMail.Send