Objeto AppointmentItem (Outlook)

Representa uma reunião, um compromisso de uma única vez ou um compromisso ou reunião recorrente na pasta Calendário.

Comentários

Use a CreateItem método para criar um objeto AppointmentItem que representa um novo compromisso.

Use Itens (índice), em que o índice é o número de índice de um compromisso ou um valor usado para corresponder à propriedade padrão de um compromisso, para retornar um único objeto AppointmentItem de uma pasta Calendar.

Você também pode retornar um objeto AppointmentItem de MeetingItem objeto usando o GetAssociatedAppointment método.

Quando você trabalha com os itens de compromisso recorrente, deve liberar qualquer referência anterior, obter referências de novas para o item de compromisso recorrente a antes de acessar ou modificar o item e liberar essas referências assim que você tiver terminado e salvou as alterações. Essa prática se aplica ao objeto AppointmentItem recorrente e qualquer objeto de exceção ou RecurrencePattern. Para liberar uma referência no Visual Basic for Applications (VBA) ou no Visual Basic, defina esse objeto existente como Nothing. Em c#, release explicitamente a memória para o objeto.

Observe que, mesmo depois que você liberar a sua referência e tenta obter uma referência de nova, se ainda houver uma referência ativa, conduzida por outro suplemento ou no Outlook, como um dos objetos acima, sua nova referência continuarão a apontar para uma cópia desatualizada do objeto. Portanto, é importante que você libera seus referências tão logo terminar com um compromisso recorrente.

O exemplo de código a seguir no VBA mostra como liberar e atualizar as referências para obter dados atualizados para um compromisso recorrente. O exemplo obtém um conjunto de itens de compromisso da pasta Calendário. Ele pressupõe que o primeiro item na coleção compromisso é parte de um compromisso recorrente. O exemplo mostra que uma referência para a coleção de compromisso obtida antes que uma exceção seja criada não reflete a exceção. O exemplo então libera essa referência e outras referências de compromisso existente, após o quais novas referências apontar para o conjunto de compromisso refletem a exceção.

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

Exemplo

O seguinte exemplo do Visual Basic for Applications (VBA) retorna um novo compromisso.

Set myItem = Application.CreateItem(olAppointmentItem)

Eventos

Nome
AfterWrite
AttachmentAdd
AttachmentRead
AttachmentRemove
BeforeAttachmentAdd
BeforeAttachmentPreview
BeforeAttachmentRead
BeforeAttachmentSave
BeforeAttachmentWriteToTempFile
BeforeAutoSave
BeforeCheckNames
BeforeDelete
BeforeRead
Close
CustomAction
CustomPropertyChange
Encaminhar
Open
PropertyChange
Leitura
ReadComplete
Responder
ReplyAll
Send
Unload
Escrever

Métodos

Nome
ClearRecurrencePattern
Close
Copiar
CopyTo
Delete
Exibição
ForwardAsVcal
GetConversation
GetOrganizer
GetRecurrencePattern
Move
PrintOut
Responder
Save
SaveAs
Send
ShowCategoriesDialog

Propriedades

Nome
Actions
AllDayEvent
Application
Anexos
AutoResolvedWinner
BillingInformation
Body
BusyStatus
Categorias
Classe
Companies
Conflicts
ConversationID
ConversationIndex
ConversationTopic
CreationTime
DownloadState
Duration
End
EndInEndTimeZone
EndTimeZone
EndUTC
EntryID
ForceUpdateToAllAttendees
FormDescription
GetInspector
GlobalAppointmentID
Importance
InternetCodepage
IsConflict
IsRecurring
ItemProperties
LastModificationTime
Localização
MarkForDownload
MeetingStatus
MeetingWorkspaceURL
MessageClass
Mileage
NoAging
OptionalAttendees
Organizador
OutlookInternalVersion
OutlookVersion
Responsável
PropertyAccessor
Destinatários
RecurrenceState
ReminderMinutesBeforeStart
ReminderOverrideDefault
ReminderPlaySound
ReminderSet
ReminderSoundFile
ReplyTime
RequiredAttendees
Resources
ResponseRequested
ResponseStatus
RTFBody
Saved
SendUsingAccount
Sensitivity
Sessão
Tamanho
Start
StartInStartTimeZone
StartTimeZone
StartUTC
Subject
UnRead
UserProperties

Confira também

Referência de modelo de objeto do Outlookcomo importar dados XML de nomeação para os objetos de nomeação do Outlook Membrosdo objeto AppointmentItem

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.