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
'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.