Share via


Appointment Object

Outlook Developer Reference
Appointment Object

The Appointment object represents an appointment record associated with a new or existing account, business contact, or opportunity.

Version Information
 Version Added:  Outlook 2007

Requirements

Business Contact Manager for Outlook

Remarks

To create a new appointment programmatically, do the following:

  1. Create an Outlook.AppointmentItem object and save it to the Outlook Calendar.
  2. Create a Outlook.JournalItem object of type Meeting.
  3. Set the Parent Entity EntryID Property property of the journal item to the entry ID of a new or existing account, business contact, or opportunity.

Appointment records appear in the Outlook Calendar, and should remain locked for the duration of the meeting. You must link an Appointment object with an Account, Business Contact, Opportunity, or Business Project object. The Communication History folder contains appointment items.

Example

The following C# and Visual Basic for Applications (VBA) examples show how to create a new object instance of type IPM.Appointment.

C#
  
Outlook.AppointmentItem appointmentItem = (Outlook.AppointmentItem)bcmHistoryFolder.Items.Add("IPM.Appointment");
            appointmentItem.Subject = "Meet to discuss the new architecture";
            appointmentItem.Body = "Need to finalize on the Architecture...";
            appointmentItem.Start = System.DateTime.Parse("3/20/2006 1:30:00 PM");
            appointmentItem.Duration = 40;
            appointmentItem.Save();
        Outlook.JournalItem newHistoryTaskItem = (Outlook.JournalItem)bcmHistoryFolder.Items.Add("IPM.Activity.BCM");
        newHistoryTaskItem.Subject = appointmentItem.Subject;
        newHistoryTaskItem.Start = appointmentItem.Start;
        newHistoryTaskItem.Duration = appointmentItem.Duration;
        newHistoryTaskItem.Type = "Meeting";
        
        //If the Outlook Appointment gets deleted, then the information is preserved in the Business Activity
        newHistoryTaskItem.Body = "StartDate: " + appointmentItem.Start + "\n" + "Duration: " + appointmentItem.Duration;

        if (newHistoryTaskItem.UserProperties["Parent Entity EntryID"] == null)
        {
            Outlook.UserProperty userProp = newHistoryTaskItem.UserProperties.Add("Parent Entity EntryID", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
            userProp.Value = newAcct.EntryID;
        }

        if (newHistoryTaskItem.UserProperties["LinkToOriginal"] == null)
        {
            Outlook.UserProperty userProp = newHistoryTaskItem.UserProperties.Add("LinkToOriginal", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
            userProp.Value = appointmentItem.EntryID;
        }

        newHistoryTaskItem.Save();
Visual Basic for Applications
  
Set newAppItem = olApp.CreateItem(olAppointmentItem)
   newAppItem.Subject = "Meet to discuss the new architecture"
   newAppItem.Body = "Need to finalize on the Architecture..."
   newAppItem.Start = #3/20/2006 1:30:00 PM#
   newAppItem.Duration = 40
   newAppItem.Save

Set newHistoryTaskItem = bcmHistoryFolder.Items.Add("IPM.Activity.BCM") newHistoryTaskItem.Subject = newAppItem.Subject newHistoryTaskItem.Start = newAppItem.Start newHistoryTaskItem.Duration = newAppItem.Duration newHistoryTaskItem.Type = "Meeting"

'If the Outlook Appointment gets deleted, then the information is preserved in the body of the Business Activity newHistoryTaskItem.Body = "StartDate: " & newAppItem.Start & vbNewLine & "Duration: " & newAppItem.Duration

If (newHistoryTaskItem.UserProperties("Parent Entity EntryID") Is Nothing) Then Set userProp = newHistoryTaskItem.UserProperties.Add("Parent Entity EntryID", olText, False, False) userProp.Value = newAcct.EntryID End If

If (newHistoryTaskItem.UserProperties("LinkToOriginal") Is Nothing) Then Set userProp = newHistoryTaskItem.UserProperties.Add("LinkToOriginal", olText, False, False) userProp.Value = newAppItem.EntryID End If

newHistoryTaskItem.Save

User Properties (Business Contact Manager only)

None. All properties derive from the parent object.

Parent Objects

AppointmentItem Object

For more information, see the Outlook 2007 Developer Reference by going to the MSDN Office Developer Center Web site.

See Also

Business Notes | E-Mail Messages | Files | Phone Logs | Tasks