Objeto AppointmentItem (Outlook)

Representa una reunión, una cita única o una cita o reunión periódica en la carpeta Calendario.

Comentarios

Use el método CreateItem para crear un objeto AppointmentItem que represente una cita nueva.

Use Items (index), donde index es el número de índice de una cita o un valor que se usa para coincidir con la propiedad predeterminada de una cita, para devolver un único objeto AppointmentItem de una carpeta Calendar.

También puede devolver un objeto AppointmentItem desde un objeto MeetingItem mediante el método GetAssociatedAppointment.

Cuando trabaja con elementos de cita periódica, debe liberar toda referencia anterior, obtener referencias nuevas al elemento de cita periódica antes de tener acceso al elemento o modificarlo y liberar estas referencias tan pronto haya terminado y guardado los cambios. Esta práctica se aplica al objeto AppointmentItem periódico y cualquier objeto RecurrencePattern o de excepción. Para liberar una referencia en Visual Basic para Aplicaciones (VBA) o Visual Basic, establezca ese objeto existente en nada. En C#, libere explícitamente la memoria para ese objeto.

Tenga en cuenta que incluso después de liberar la referencia e intentar obtener una referencia nueva, si aún hay una referencia activa, mantenida por otro complemento u Outlook, a uno de los objetos anteriores, la referencia nueva aún apuntará a una copia obsoleta del objeto. Por lo tanto, es importante liberar las referencias tan pronto haya terminado con la cita periódica.

En el siguiente ejemplo de código en VBA se muestra cómo liberar y actualizar las referencias con el fin de obtener datos actualizados de una cita periódica. En el objeto se obtiene una serie de elementos de cita de la carpeta Calendario. Se presupone que el primer elemento de la colección de citas forma parte de una cita periódica. En el ejemplo se muestra que una referencia a la colección de citas obtenida antes de la creación de una excepción no refleja la excepción. A continuación, se libera la referencia y otras referencias de cita existentes, después de lo cual las nuevas referencias que apuntan a esa colección de citas reflejan la excepción.

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

Ejemplo:

En el ejemplo siguiente de Visual Basic para aplicaciones (VBA) se devuelve una nueva cita.

Set myItem = Application.CreateItem(olAppointmentItem)

Eventos

Nombre
AfterWrite
AttachmentAdd
AttachmentRead
AttachmentRemove
BeforeAttachmentAdd
BeforeAttachmentPreview
BeforeAttachmentRead
BeforeAttachmentSave
BeforeAttachmentWriteToTempFile
BeforeAutoSave
BeforeCheckNames
BeforeDelete
BeforeRead
Close
CustomAction
CustomPropertyChange
Reenviar
Open
PropertyChange
Lectura
ReadComplete
Reply
ReplyAll
Send
Unload
Write

Métodos

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

Propiedades

Nombre
Actions
AllDayEvent
Application
Archivos adjuntos
AutoResolvedWinner
BillingInformation
Body
BusyStatus
Categorías
Class
Companies
Conflicts
ConversationID
ConversationIndex
ConversationTopic
CreationTime
DownloadState
Duración
End
EndInEndTimeZone
EndTimeZone
EndUTC
EntryID
ForceUpdateToAllAttendees
FormDescription
GetInspector
GlobalAppointmentID
Importance
InternetCodepage
IsConflict
IsRecurring
ItemProperties
LastModificationTime
Ubicación
MarkForDownload
MeetingStatus
MeetingWorkspaceURL
MessageClass
Mileage
NoAging
OptionalAttendees
Organizador
OutlookInternalVersion
OutlookVersion
Parent
PropertyAccessor
Destinatarios
RecurrenceState
ReminderMinutesBeforeStart
ReminderOverrideDefault
ReminderPlaySound
ReminderSet
ReminderSoundFile
ReplyTime
RequiredAttendees
Resources
ResponseRequested
ResponseStatus
RTFBody
Saved
SendUsingAccount
Sensitivity
Session
Size
Start
StartInStartTimeZone
StartTimeZone
StartUTC
Subject
UnRead
UserProperties

Consulte también

Referencia del modelo de objetos de OutlookProcedimiento para importar datos XML de cita en objetos de cita de OutlookMiembros del objeto AppointmentItem

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.