6 ตุลาคม 2548 10:52Hi,
I've learned how to create contact, tasks and appointments from an outlook add-in project with Visual Studio 2005 (release candidate).
For example I create a contact and an appointment in this way:
// create a contact and save it
Outlook.ContactItem newContact = MyContactFolder.Items.Add(
Outlook.OlItemType.olContactItem) as Outlook.ContactItem;
newContact.FirstName = firstName;
newContact.LastName = lastName;
newContact.Email1Address = email1Address
newContact.CustomerID = customerID;
newContact.PrimaryTelephoneNumber = primaryTelephoneNumber;
// create an appointment and save it
Outlook.AppointmentItem newEvent =
newEvent.Start = newEventStart;
newEvent.End = newEventEnd;
newEvent.Subject = newEventSubject;
newEvent.Body = newEventBody;
newEvent.UserProperties["ID"].Value = eventID;
This works fine and I see the new contact and the new appointment in Outlook. Arrived at this point, I would like to see the appointment in the "Activities" pane of the contact. What am I supposed to do via code ?
10 ตุลาคม 2548 12:18ผู้ดูแลHi Marco
I believe this is done on a cross search based on the information stored within the Contact, IE an email address used to send an email to or from is used to list within the activities window and this looks like it is done dynamically, if you are creating an appointment then a contact it might be worth swapping this around and making sure you use the email address as a common element.
19 ตุลาคม 2548 9:29
Thanks for your indication, I've been able to solve the problem.
For an appointment I use the following code:
Outlook.AppointmentItem appointment = (...) // code to get the appointment
Outlook.ContactItem contact = (...) // code to get the contact
appointment.RequiredAttendees = contact; // this shows the contact in the appointment inspector
appointment.Links.Add(contact); // this shows the appointment in the contact activities
It's unbelievable the power we have with .NET on Outlook.
thanks again !