none
Outlook Appointment and Sending Emails RRS feed

  • Question

  • Hey! Im working with a program that will make and send emails.
    My Question is if anyone knows if you can get a hyperlink from a Appointment.
    The hyperlink are going to be the reciever of the email. I also want to make that it only check for the appointment of the day.
    Anyone have some ideas?

                try
                {
                    Outlook.Application outlookApp = new Outlook.Application();
                    Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                    //Outlook.AppointmentItem appointmentItem = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
                    mailItem.Subject = "Build Uppgradering av Skarp och test PM "+ KundNamn +" Klar. ";
                    mailItem.To = "carlo.goretti@live.se";
                    mailItem.CC = "Hanna.Lovinder@momentum.se";
                    mailItem.Body = "Hej," +
                    "\n\n" +
                    "Hej nu är build uppgradering klar av er skarp och test PM installation klar. " +
                    "\n" +
                    "Om man saknar sökvägar skarpa versionen:" +
                    KortLänkProd +
                    "\n\n" +
                    "Eller" +
                    LångLänkProd +
                    "\n\n\n\n" +
                    "Om man saknar sökvägar till test versionen:" +
                    KortLänkTest +
                    "\n\n" +
                    LångLänkTest +
                    "\n\n" +
                    "Om ni har några frågor eller stöter på några problem så får ni gärna återkomma." +
                    "\n\n" +
    
                    //appointmentItem.Body
                    "Med Vänliga Hälsningar"; //+ ReadSignature() + mailItem.HTMLBody;
                    //+ mailItem.HTMLBody + ReadSignature();
                    mailItem.Importance = Outlook.OlImportance.olImportanceLow;
                    mailItem.Display(false);
                }
                catch (Exception eX)
                {
                    throw new Exception("cDocument: Error occurred trying to Create an Outlook Email"
                                        + Environment.NewLine + eX.Message);
                }

    Wednesday, September 25, 2019 7:07 PM

All replies

  • Hi,

    According to your description, your issue is more related about C#.  I will move your question to the C# forum.

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Thursday, September 26, 2019 3:25 AM
  • Hi Carlo,

    You could try the following code to insert a hyperlink to the appointment.

     Application application = new Application();
                Outlook.AppointmentItem newAppointment =(Outlook.AppointmentItem) application.CreateItem(Outlook.OlItemType.olAppointmentItem);
                newAppointment.Start = DateTime.Now.AddMinutes(1);
                newAppointment.End = DateTime.Now.AddHours(3);
                newAppointment.Location = "ConferenceRoom #2345";
                newAppointment.Body ="We will discuss progress on the group project.";
                newAppointment.AllDayEvent = false;
                newAppointment.Subject = "Group Project";
                newAppointment.Recipients.Add("'com");
                RichTextBox rtb = new RichTextBox();
                rtb.Rtf = System.Text.Encoding.UTF8.GetString(newAppointment.RTFBody);
                rtb.Select(rtb.TextLength, 0);
                rtb.SelectedRtf = @"{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard {\par} {\field{\*\fldinst HYPERLINK ""http://www.google.com/""}{\fldrslt Click Here}}";
    
                newAppointment.RTFBody = System.Text.Encoding.UTF8.GetBytes(rtb.Rtf);
                newAppointment.Save();
                newAppointment.Display(true);

    Result:

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, September 26, 2019 7:51 AM
    Moderator
  • Thanks! But i want to get the hyperlink from an apointment.. Any idea how to do that? For example:
    I want to get all hyperlinks in every appointment body wich have appointment date today.
    Monday, September 30, 2019 10:33 AM