AppointmentItem オブジェクト (Outlook)

予定表フォルダーの会議、1 回限りの予定、または定期的な予定や会議を表します。

注釈

CreateItem メソッドを使用して、新しい予定を表す AppointmentItem オブジェクトを作成します。

Items (index) を使用して、予定のインデックス番号または予定の既定のプロパティと一致するために使用される値を index を使用して、Calendar フォルダーから 1 つの AppointmentItem オブジェクトを返します。

また、 GetAssociatedAppointment メソッドを使用して、 MeetingItem オブジェクトから AppointmentItem オブジェクトを返すこともできます。

定期的な予定アイテムの作業を行うときは、以前の参照を解放し、定期的な予定アイテムへの新しい参照を取得してからアイテムにアクセスしたりアイテムを変更したりした後、作業が終了して変更を保存したら直ちに参照を解放する必要があります。 このような方法を適用するのは、定期的な AppointmentItem オブジェクト、およびすべての Exception または RecurrencePattern オブジェクトです。 Visual Basic for Applications (VBA) または Visual Basic で参照を解放するには、既存のオブジェクトを Nothing に設定します。 C# では、そのオブジェクトのメモリを明示的に解放します。

参照を解放して新しい参照の取得を試行した後でも、別のアドインまたは Outlook により保持されている、上述のオブジェクトの 1 つへのアクティブな参照 がある場合、新しい参照は最新ではないオブジェクトのコピーをポイントし続けることにご注意ください。 そのため、定期的な予定の操作を完了したら、すぐに参照を解放することが重要です。

次の VBA のコード例は、定期的な予定の最新データを取得するために、参照を解放および更新する方法を示しています。 この例は、予定表フォルダーから予定アイテムのセットを取得します。 予定コレクションの最初のアイテムは、定期的な予定の一部であると想定しています。 この例は、例外が作成される前に取得された予約コレクションへの参照は、例外が反映されないことを示しています。 次に、この参照、および予定コレクションをポイントしている新しい参照に例外が反映された後に存在する他の予定の参照を解放します。

Sub TestExceptions() 
 
 Dim oItems As Items 
 
 Dim oItemOriginal As AppointmentItem 
 
 Dim oItemNew As AppointmentItem 
 
 Dim rPattern As RecurrencePattern 
 
 Dim oEx As Exceptions 
 
 Dim oEx2 As Exceptions 
 
 Dim oOccurrence As AppointmentItem 
 
 Dim i As Long 
 
 
 
 ' This is the initial reference to an appointment collection. 
 
 Set oItems = _ 
 
 Outlook.Application.Session.GetDefaultFolder(olFolderCalendar).Items 
 
 
 
 ' This is the original reference to the first appointment in the 
 
 ' collection before an exception is created. 
 
 Set oItemOriginal = oItems.Item(1) 
 
 
 
 ' Code example assumes that the first appointment in the collection 
 
 ' is a recurring appointment. 
 
 Set oOccurrence = _ 
 
 oItemOriginal.GetRecurrencePattern().GetOccurrence(#2/28/2010 8:00:00 AM#) 
 
 
 
 ' Create an exception by changing the 2/28 occurrence to 3/3. 
 
 oOccurrence.Start = #3/3/2010 8:00:00 AM# 
 
 oOccurrence.Save 
 
 
 
 Stop 
 
 
 
 ' Preexisting reference to the first appointment in the collection 
 
 ' does not reflect the exception. 
 
 oItemOriginal.Save 
 
 Set oEx = oItemOriginal.GetRecurrencePattern().Exceptions 
 
 Debug.Print oItemOriginal.subject 
 
 Debug.Print " Original item exceptions: " & oEx.Count 
 
 
 
 ' Get a new reference based on the existing reference to the 
 
 ' appointment collection created before the exception. 
 
 ' The new reference does not reflect the exception. 
 
 Set oItemNew = oItems.Item(1) 
 
 oItemNew.Save 
 
 Set oEx2 = oItemNew.GetRecurrencePattern().Exceptions 
 
 Debug.Print " New item exceptions: " & oEx2.Count 
 
 
 
 ' Same: preexisting reference to the first appointment in the collection 
 
 ' does not reflect the exception. 
 
 Set oEx = oItemOriginal.GetRecurrencePattern().Exceptions 
 
 Debug.Print " Original item exceptions: " & oEx.Count 
 
 
 
 ' Release all existing references to appointment items, 
 
 ' including the appointment collection, an exception, occurrence, 
 
 ' or any other appointment. 
 
 Debug.Print "REFRESH ITEM COLLECTION" 
 
 Set oItems = Nothing 
 
 Set oItemNew = Nothing 
 
 Set oEx = Nothing 
 
 Set oEx2 = Nothing 
 
 Set oOccurrence = Nothing 
 
 Set oItemOriginal = Nothing 
 
 Set rPattern = Nothing 
 
 
 
 ' Get new references to appointment items, including the appointment 
 
 ' collection, individual appointments, and exceptions. 
 
 Set oItems = _ 
 
 Outlook.Application.Session.GetDefaultFolder(olFolderCalendar).Items 
 
 Set oItemNew = oItems.Item(1) 
 
 
 
 ' If no other add-ins have the same recurring appointment open, 
 
 ' the new references reflect the current exception count. 
 
 Set oEx2 = oItemNew.GetRecurrencePattern().Exceptions 
 
 Debug.Print " New item exceptions: " & oEx2.Count 
 
 
 
 Debug.Print "RE-GET ORIGINAL" 
 
 Set oItemOriginal = oItems.Item(1) 
 
 Set oEx = oItemOriginal.GetRecurrencePattern().Exceptions 
 
 Debug.Print " Original item exceptions: " & oEx.Count 
 
End Sub

次の Visual Basic for Applications (VBA) の例は、新しい予定を返します。

Set myItem = Application.CreateItem(olAppointmentItem)

イベント

名前
AfterWrite
AttachmentAdd
AttachmentRead
AttachmentRemove
BeforeAttachmentAdd
BeforeAttachmentPreview
BeforeAttachmentRead
BeforeAttachmentSave
BeforeAttachmentWriteToTempFile
BeforeAutoSave
BeforeCheckNames
BeforeDelete
BeforeRead
Close
CustomAction
CustomPropertyChange
Forward
Open
PropertyChange
読み取り
ReadComplete
Reply
ReplyAll
Send
Unload
Write

メソッド

名前
ClearRecurrencePattern
Close
Copy
CopyTo
Delete
Display
ForwardAsVcal
GetConversation
GetOrganizer
GetRecurrencePattern
Move
PrintOut
Respond
Save
SaveAs
Send
ShowCategoriesDialog

プロパティ

Name
Actions
AllDayEvent
アプリケーション
添付ファイル
AutoResolvedWinner
BillingInformation
Body
BusyStatus
Categories
クラス
Companies
Conflicts
ConversationID
ConversationIndex
ConversationTopic
CreationTime
DownloadState
期間
End
EndInEndTimeZone
EndTimeZone
EndUTC
EntryID
ForceUpdateToAllAttendees
FormDescription
GetInspector
GlobalAppointmentID
Importance
InternetCodepage
IsConflict
IsRecurring
ItemProperties
LastModificationTime
場所
MarkForDownload
MeetingStatus
MeetingWorkspaceURL
MessageClass
Mileage
NoAging
OptionalAttendees
Organizer
OutlookInternalVersion
OutlookVersion
Parent
PropertyAccessor
受信者
RecurrenceState
ReminderMinutesBeforeStart
ReminderOverrideDefault
ReminderPlaySound
ReminderSet
ReminderSoundFile
ReplyTime
RequiredAttendees
リソース
ResponseRequested
ResponseStatus
RTFBody
Saved
SendUsingAccount
Sensitivity
Session
Size
Start
StartInStartTimeZone
StartTimeZone
StartUTC
件名
UnRead
UserProperties

関連項目

Outlook オブジェクト モデル リファレンス方法: 予定の XML データを Outlook 予定オブジェクトにインポートするAppointmentItem オブジェクト メンバー

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。