More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 17-Sep-2014 14:32

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

Login Password
Remember me
Register | Send my password
    Page [ 1 ]  
 Basic Outlook Printer Friendly Version
Working with Outlook items, folders, recipients; dealing with security; writing event handlers
Topic
Table in appointment body
Need Help!!!!
I would like to insert a table in the body of the appointment I dont want to send an attachment. I have a set of data from MS Acccess I am very much comfortable in exporting and importing the data but I would like to show the data in a table format in the body of the Outlook appointment. Kindly throgh some light on my problem I greatly appreciate any inputs

Thank you,
Ray

  13-Aug-2004  16:07
  13-Aug-2004  16:17   
That's much easier said than done, since the appointment body is in rich-text format and Outlook provides no direct way to work with it. You'll have to use either Redemption or CDO+a helper .dll to set the RTF content with your fully RTF string (which Access should be able to help you produce -- I think it has some RTF output methods). See http://www.outlookcode.com/d/formatmsg.htm
  20-Aug-2004  15:14   
I really should thank you for the early response: First: I mailed the appointment data + table details from the Access and then I used the Read_RTF to read the email HTML formatted in RTF and then assigned this RTF formatted data to the outlook appointment body but the table is not formatted properly (not able to get the cell and table border) hence I tried the Write_RTF after the Read_RTF, to write the RTF formatted email in the appointment still had the same problem.and I am using Outlook2000 so I didnt try using redemption am I missing something here??? or do I have to try something else kindly help me I am comfortable in using the CDO + the mapirtf.dll (I can able to reporduce the same effect by just dragging my email to the calendar).
Thanks a bunch
Ray
  20-Aug-2004  16:17   
What do you mean by "read the email HTML formatted in RTF"?

Maybe you should format the table as you want it to look in Word, then look at the RTF from that and compare with what you have.

You probably ought to try Redemption, too.
 
  03-Mar-2008  05:39   
Hi All,

The below is the code, I'm using to create an Appointment. I tried putting html tags and in Outlook - it displays as plain text. I want to save appointment with rich text body having tables, colors, etc., Plz help - how to achieve.

public void CallOutlookAPI(string person, string subject, string appComment, DateTime startDate, DateTime endDate)
        {
            Outlook.NameSpace objNS;
            Outlook.MAPIFolder objSharedCalendar;
            Outlook.Recipient myOrganizer;

            string sName = sPerson;
            Outlook._Application objApp = (Outlook._Application)new Outlook.Application();
            objNS = objApp.GetNamespace("MAPI");

            try
            {
                //Create a receipient object that is going to be the organizer of the meeting
                myOrganizer = objNS.CreateRecipient(sName);
                myOrganizer.Type = (int)Outlook.OlMeetingRecipientType.olOrganizer;

                myOrganizer.Resolve();

                if (myOrganizer.Resolved)
                {
                    objSharedCalendar = objNS.GetSharedDefaultFolder(myOrganizer, Outlook.OlDefaultFolders.olFolderCalendar);

                    Outlook._AppointmentItem objCalendarEntry =
                            (Outlook._AppointmentItem)objSharedCalendar.Items.Add(Outlook.OlItemType.olAppointmentItem);

                    objCalendarEntry.Subject = subject;
                    //objCalendarEntry.Body = appComment;
                    objCalendarEntry.Start = startDate;
                    objCalendarEntry.End = endDate;

                    objCalendarEntry.AllDayEvent = false;
                    objCalendarEntry.Location = "";
                    objCalendarEntry.BusyStatus = Outlook.OlBusyStatus.olBusy;
                    objCalendarEntry.Sensitivity = Outlook.OlSensitivity.olConfidential;
                    objCalendarEntry.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;

                    string sHtmlText = string.Empty;

                    sHtmlText = sHtmlText + "<table bgcolor=#AFDEFF>";
                    sHtmlText = sHtmlText + "<tr>";
                    sHtmlText = sHtmlText + "<td>A</td>";
                    sHtmlText = sHtmlText + "<td>B</td>";
                    sHtmlText = sHtmlText + "</tr>";
                    sHtmlText = sHtmlText + "<tr>";
                    sHtmlText = sHtmlText + "<td>C</td>";
                    sHtmlText = sHtmlText + "<td>D</td>";
                    sHtmlText = sHtmlText + "</tr>";
                    sHtmlText = sHtmlText + "</table>";

                    objCalendarEntry.Body = sHtmlText;

                    objCalendarEntry.Save();
                  }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                ORILogger.LogError(ex.ToString());
            }
            catch (Exception ex)
            {
                ORILogger.LogError(ex.ToString());
            }
            finally
            {
            }
        }
    }
  03-Mar-2008  08:07   
As I explained above, appointment bodies are RTF, not HTML. See http://www.outlookcode.com/article.aspx?id=31 for techniques for working with formatting in RTF item bodies.
  08-Mar-2008  23:07   
Hi Sue,

Thankx for ur reply. I checked the sample mentioned in link - but for real time, opening a word dll, getting the functionality, deallocating - is not a good solution. For our project scenario, The messages will be coming from MSMQ and the logic should work to convert in to formatted text in body of appointment.

Rightnow, I'm managing by formatting simple text by tab character. If Rich format like colours are there - it will add value to my project.

Plz help if possible?
 
  09-Mar-2008  01:07   
I've already pointed you toward the page that goes over the three available approaches to this issue. If you have a specific question about any of them, please ask it. Otherwise, I don't know what additional help you're looking for.
    Page [ 1 ]