0

在网站上回复电子邮件时,我会在收件箱中收到我的回复副本。我正在创建将更新我的 Outlook 收件箱并将原始查询显示为已回复的代码,然后将我的回复移动到“已发送邮件”文件夹。除了不会将邮件项移动到“已发送邮件”文件夹之外,所有代码都有效。我不确定“已发送邮件”是否是受限制的文件夹,或者我哪里出错了。我的代码如下:

'locate the imap folder rather than the default outlook folder
 Set oFolder= Application.GetNamespace("MAPI").Folders(myIMAPFolder)
 Set oInbox = oFolder.Folders("Inbox")

 'sort the inbox based on the time received to find the most recent mail with  a matching subject and sender
 Set MyItems = oInbox.Items
 MyItems.Sort "ReceivedTime", True
 i = 0
 Do
     i = i + 1
     sSearch = Mid(m.Subject, 5, 100)
     Set oReply = MyItems(i)
 Loop Until oReply.Subject = sSearch And oReply.SenderEmailAddress = m.Recipients(1).Address

 'add the reply icon to the mail in the inbox and mark the original message as being read
 With oReply
     .PropertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x10800003", 261 'standard replied icon
      .UnRead = False
      .Save
  End With

  'move my incoming message to the "Sent Items Folder" & mark as being read
  '**** THIS SECTION OF CODE DOESN'T WORK??? ****
  Set oSent = oFolder.Folders("Sent Items")
  With m
      .Move (oSent)
      .UnRead = False
      .Save
  End With
4

1 回答 1

0

Move 是一个返回新项目的函数。旧项目必须立即释放。无需调用 Save

Set oSent = oFolder.Folders("Sent Items")
m = m.Move(Set)
于 2015-11-24T01:25:18.347 回答