0

Web サイトでメールに返信すると、返信のコピーが受信トレイに返されます。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