Move
Outlook マクロでメソッドを使用するAppointmentItem
と、アイテムを実際に移動するのではなく、アイテムのコピーを作成するため、更新を受け取ることができなくなります。この動作により、アイテムが元のアイテムとリンクされなくなり、結果としてアイテムの更新が保持されなくなります。
元のオブジェクトを維持でき、更新が失われないカット/ペーストの動作を VBA で複製したいと考えています。
これは、検索に基づいて GlobalAppointmentID と関係があると思いますが、実際に予定を移動する方法を見つけることができませんでした。
私が使用しているコードは以下のとおりです。GetFolderFromPath は、パスからフォルダー オブジェクトを返すヘルパー関数であり、完全に機能します。
Sub MoveItem()
Dim targetPath As String: targetPath = "\\tnolan@microsoft.com\Calendar\OOFS"
If Application.ActiveExplorer.Selection.Count = 0 Then
MsgBox ("No item selected")
Exit Sub
Else
Dim targetFolder As Outlook.Folder
Set targetFolder = GetFolderFromPath(targetPath)
For x = 1 To Application.ActiveExplorer.Selection.Count
Dim oSelected As Variant
Set oSelected = Application.ActiveExplorer.Selection.Item(x)
If oSelected.Class = olAppointment Then
Dim NS As NameSpace: Set NS = Application.GetNamespace("MAPI")
Dim oAppt As AppointmentItem: Set oAppt = NS.GetItemFromID(oSelected.EntryID)
oAppt.Move targetFolder
Set oAppt = Nothing
Set NS = Nothing
End If
Set oSelected = Nothing
Next x
Set targetFolder = Nothing
End If
End Sub