Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
You can add attachments to appointments and meetings. For example, you could attach an image of a map to a meeting to show where the meeting is located.
Attachments are added using the Attachments collection of the Appointment object. Attachments are saved with the Appointment object in the Web Store.
To add an attachment to an appointment or meeting
The following code example shows how to add the attachment d:\maps\directions.gif to a meeting.
Dim iAppt As New Appointment Dim CalendarURL As String Dim iCalMsg As CalendarMessage Dim iAttendee As New Attendee Dim Config As New Configuration Dim iBp As IBodyPart Dim Stm As Stream Dim Flds As Fields CalendarURL = "file://./backofficestorage/" & DomainName & "/MBX/" & UserName & "/calendar/" 'Set the configuration fields Config.Fields(cdoSendEmailAddress) = UserName & "@" & DomainName Config.Fields.Update iAppt.Configuration = Config 'Set the meeting properties iAppt.StartTime = #10/27/1999 1:30:00 PM# iAppt.EndTime = #10/27/1999 2:30:00 PM# iAppt.Subject = "Department Off-Site" iAppt.Location = "617 Main St." iAppt.TextBody = "Lunch will be served! See the attached map for directions." 'Create a new attachment body part Set iBp = iAppt.Attachments.Add 'Set the fields for the attachment Set Flds = iBp.Fields Flds.Item("urn:schemas:mailheader:content-type") = "image/gif; name=directions.gif" Flds.Item("urn:schemas:mailheader:content-transfer-encoding") = "base64" Flds.Update 'Get the stream interface on the body part Set Stm = iBp.GetDecodedContentStream 'Load the attachment file into the stream and flush ' the stream to save it back to the body part Stm.LoadFromFile ("d:\maps\directions.gif") Stm.Flush 'Add an attendee Set iAttendee = iAppt.Attendees.Add iAttendee.Address = "someone@" & DomainName iAttendee.Role = cdoRequiredParticipant 'Create the calendar message and send it Set iCalMsg = iAppt.CreateRequest iCalMsg.Message.Send 'Save the meeting to the organizer's calendar iAppt.DataSource.SaveToContainer CalendarURL