We can see that the outlook API is called in C # To initiate a meeting. This can be fully implemented using SMTP. The code used in my project is as follows:
For. net, it is very easy to send emails from 2.0. In addition,Alternateview,You can use the alternateview class to specify different copies of an email. For example, if you send an HTML-format email, you may want to provide the plain text format of the email at the same time, in case some email reading programs used by recipients cannot display HTML content.
By using alternateview, we can send exchange meeting emails. The core code is as follows:
Mailmessage MSG = new mailmessage ();
// Set up the different MIME types contained in the message
System. net. Mime. contenttype texttype = new system. net. Mime. contenttype ("text/plain ");
System. net. Mime. contenttype htmltype = new system. net. Mime. contenttype ("text/html ");
System. net. Mime. contenttype calendartype = new system. net. Mime. contenttype ("text/Calendar ");
// Add parameters to the calendar Header
Calendartype. Parameters. Add ("method", "request ");
Calendartype. Parameters. Add ("name", "meeting. ICS ");
// Create message body parts
// Create the body in text format
String bodytext = "type: single meeting" R "norganizer: {0}" R "nstart time: {1}" R "nend time: {2}" R "ntime zone: {3} "R" nlocation: {4} "R" N "R" N *~ *~ *~ *~ *~ *~ *~ *~ *~ * "R" N "R" n {5 }";
Bodytext = string. format (bodytext, organizername, start. tolongdatestring () + "" + start. tolongtimestring (), end. tolongdatestring () + "" + end. tolongtimestring (), system. timezone. currenttimezone. standardname, location, summary );
Alternateview textview = alternateview. createalternateviewfromstring (bodytext, texttype );
MSG. alternateviews. Add (textview );
// Create the body in HTML Format
String bodyhtml = "<! Doctype HTML public ""-// W3C // dtd html 3.2 // en ""> "R" n <HTML> "R" n
Bodyhtml = string. format (bodyhtml, summary, organizername, start. tolongdatestring () + "" + start. tolongtimestring (), end. tolongdatestring () + "" + end. tolongtimestring (), system. timezone. currenttimezone. standardname, location, summary );
Alternateview htmlview = alternateview. createalternateviewfromstring (bodyhtml, htmltype );
MSG. alternateviews. Add (htmlview );
// Create the body in vcalendar format
String caldateformat = "yyyymmddthhmmssz ";
String bodycalendar = "begin: vcalendar" R "nmethod: request" R "nprodid: Microsoft CDO for Microsoft Exchange" R "nversion: 2.0" R "nbegin: vtimezone "R" ntzid :( GMT-06.00) Central Time (US & Canada) "R" NX-MICROSOFT-CDO-TZID: 11 "R" nbegin: Standard "R" ndtstart: 160101t020000 "R" ntzoffsetfrom: -0500 "R" ntzoffsetto:-0600 "R" nrrule: freq = yearly; wkst = Mo; interval = 1; bymonth = 11; byday = 1su "R" nend: standard "R" nbegin: daylight "R" ndtstart: 16010101t020000 "R" ntzoffsetfrom:-0600 "R" ntzoffsetto:-0500 "R" nrrule: freq = yearly; wkst = Mo; interval = 1; bymonth = 3; byday = 2su "R" nend: daylight "R" nend: vtimezone "R" nbegin: vevent "R" ndtstamp: {8} "R" ndtstart: {0} "R" nsummary: {7} "R" nuid: {5} "R" nattendee; Role = REQ-PARTICIPANT; partstat = needs-action; RSVP = true; Cn = "" {9} "": mailto: {9} "R" naction; RSVP = true; CN = "" {4} "": mailto: {4} "R" norganizer; Cn = "" {3} "": mailto: {4} "R" nlocation: {2} "R" ndtend: {1} "R" ndescription: {7} "" N "R" nsequence: 1 "R" npriority: 5 "R" nclass: "R" ncreated: {8} "R" nlast-modified: {8} "R" nstatus: Confirmed "R" ntransp: Opaque "R" NX-MICROSOFT-CDO-BUSYSTATUS: busy "R" NX-MICROSOFT-CDO-INSTTYPE: 0 "R" NX-MICROSOFT-CDO-INTENDEDSTATUS: Busy "R" NX-MICROSOFT-CDO-ALLDAYEVENT: false "R" NX-MICROSOFT-CDO-IMPORTANCE: 1 "R" NX-MICROSOFT-CDO-OWNERAPPTID: -1 "R" NX-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE: {8} "R" NX-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE: {8} "R" nbegin: valarm "R" naction: display "R" ndescription: reminder "R" ntrigger; related = start:-pt00h15m00s "R" nend: valarm "R" nend: vevent "R" nend: vcalendar "R" N ";
Bodycalendar = string. format (bodycalendar, start. touniversaltime (). tostring (caldateformat), end. touniversaltime (). tostring (caldateformat), location, organizername, organizeremail, guid. newguid (). tostring ("B"), Summary, subject, datetime. now. touniversaltime (). tostring (caldateformat), attendeelist. tostring ());
Alternateview calendarview = alternateview. createalternateviewfromstring (bodycalendar, calendartype );
Calendarview. transferencoding = transferencoding. sevenbit;
MSG. alternateviews. Add (calendarview );
// Address the message
MSG. From = new mailaddress (organizeremail );
Foreach (mailaddress attendee in attendeelist)
{
MSG. to. Add (attendee );
}
MSG. Subject = subject;
Return MSG;
Http://rongchaua.net/blog/sharepoint-send-appointment-without-using-outlook-object/
Http://cul.codeplex.com/