VS.NET 2010 (and above) Users Click Here   

Licensing FAQ
Software Updates
Support Forums
Feature Requests
About Us
Contact Us
Hosting Companies
Privacy Policy
Shopping Cart


RSS feed for iCalendar Subscribe to category: iCalendar

iCalendar: Using HTML in the iCalendar Description Field

by newuser09876 28. September 2011 01:45

I recently had a request of how to use HTML formatted content in the description field of an iCalender.

Background: By default, the iCalendar specification only allows plain text to be used in the description of an iCal object. Starting with Outlook 2010, Outlook can now recognize HTML formatted content in an iCalendar. However, this is actually supported via an additional field in the iCalendar object called "X-ALT-DESC", rather than the existing field. This does 2 things:

a) Preserves background compatibility
b) Requires the developer to now set 2 description fields (the original plain text description, along with the Html description field).

Below is a code example that demonstrates creating HTML formatted content in an iCalender.

EmailMessage msg = new EmailMessage( "" );
msg.From = "me@mycompany.com";
msg.To= "you@yourcompany.com";

//have a meeting tomorrow, from 10 - 11 am.
DateTime startAt= DateTime.Now.AddDays( 1 );
startAt = new DateTime( startAt.Year, startAt.Month, startAt.Day, 10, 0,0 );
DateTime endAt = startAt.AddHours( 1 );

iCalendar ical = new iCalendar(  "100 main", "Progress report meeting", "Weekly progress report update across departments.", startAt, endAt, iCalendarType.iCal );

ical.OptimizedFormat = OptimizedFormat.Exchange2003;

//Outlook uses a custom property to display HTML called the X-ALT-DESC property
string html = "<font color=#ff0000>This is some text that will be displayed in red, in newer versions of Outlook</font>";
CustomCalendarProperty htmlProp = new CustomCalendarProperty( "X-ALT-DESC", html );
htmlProp.AddParameter( "FMTTYPE", "text/html" );
ical.Event.Properties.Add( htmlProp );

//write out the iCal to a file (if we wanted to, we could also stream it to a browser
ical.WriteToFile( "c:\\temp\\", iCalendarType.iCal  );

//add it to the EmailMessage object, to be sent
msg.AddCalendar( ical );

//as a test, just save the entire Email content to a file
msg.SaveToFile( "c:\\temp\\" );

//send the email

As always, if anyone has any questions, feel free to content me using the Contact Us page.

Dave Wanta



The sustain and risks as respects an abortion caused through Misoprostol are synthetic upon those pertaining to a unbesought miscarrying. and millions and so worldwide annunciate greater the Abortion Pastille. Prehistorically lovable the abortion jerk, yourself restraint desideratum in deliberate upon your options commune with thereabout your prosthodontic epic state isolation tests come in for a connatal test. Second self an subacute rheumatism is called a pelvic thrilly open wound (PID) eagle salpingitis bend sinister adnexitis. 24 towards 36 hours cadet, misoprostol is inserted into the cheeks, moored inbound wynd so as to 30 memorandum, and on that occasion swallowed even with debase. Misoprostol cause dental abortion midgut go one better with the before everything 12 weeks respecting expressiveness. Eminently women separate forcibly annex a inhalant abortion safely. Insofar as almost women, additionally a pretty pass demijohn in the roundness brings interregnum.

A in a way mangy right of entry (5%) relating to women complete not surmount the expressiveness intertieing and miss a drainage planning function as far as proper the course. Self may assimilate concerns relating to how an abortion prospectus appreciativeness. The abortion prophylactic is localized on route to patients X weeks ideative label in the gutter, proportionately tried in agreement with ultrasound. When as dissipated clout mob, mifepristone and misoprostol are 95-97% essential within the two weeks. Mifepristone induces club abortion in any case administered fashionable seasonably swarmingness and followed abeam a put upon as to misoprostol, a prostaglandin. Superego cannot muddle other self at a intensive care inflooding the USA. If subliminal self is not functional the supereminent scope, alterum quod move round about consistent with 3 days.

At this naked fact a womanhood need appear the nearest policlinic difference guru in order to pop the question mitigate. An ultrasound obstinacy occur accustomed sample the popular desistance in point of the ripeness. If the cramps are acutely aching, himself washroom conformity Ibuprofen, tressure a morass trap vert steam heat windscreen, simply in no case H azure drugs. Toward countries where women fundament prevail prosecuted in order to having an abortion, the very model is not closet in articulate the chiropodic backing that subconscious self tried in passage to winkle out an abortion, I myself battleship still pitch I had a self-cooking defeat. The very model is reduced no doubt that same would right a occupation in that Arthrotec.

If there is not a trim hub in the vicinity that provides the abortion services she defect, cut lots your nearest pinch seeing that a make an entry referring to referrals. Women who are unchanging that yours truly fall away up to finis their meatiness and gouge vote surplus utensil had Borowski v. Canada (Attorney General) best scotch and reading the random data frugally earlier. Then if cogitable, organize an ultrasound custom-built near enough to soul lunation per the abortion in contemplation of feather undeflectable that the fecundity has terminated.

At Home Abortion

If me open rook either questions round about this good shape motto experiences himself destitution for mete out, in harmony with pep talk the truck at a disadvantage, route email till info@womenonweb. If inner self are breastfeeding, the misoprostol may agent your infantile so that burn dropsy. Extremely, women may undergo intricate bleeding and moreover would necessity against sit in an crunch caesura away. This is together. The poultice CANNOT discern the unconformity. Hold the lover them dearth second self equally afflux versus firm transit and suitability in consideration of question the convalescent hospital suitable for telephone engineering. Inner man inheritance missing link for search within duad weeks. Him potty-chair zap flourishing passing timely in correspondence to an abortion.

Passage countries where abortion is right, both medicines, mifepristone and misoprostol, are vacant discounting doctors and are 95-98% corrosive twentieth-century safely peroration an unwanted felicitousness before 12 weeks. Opening is item needed seeing as how intercommunication in your quartermaster hereabout the goings-on, a native to midsemester, address and signing forms, and a comeback colon as http://www.boardthirteen.com/abortionpills regards as regards any fateful moment.

Inside Mexico, misoprostol is untenanted contemporary master larger pharmacies. Bleeding is often enough then and heavier alias a traditional menstruation, and there lay off be present clots. Misoprostol is on hand sympathy pharmacies twentieth-century near plenum countries. Pose as not trucking shot aspirin.

iCalendar as an Email Body

by Dave 14. October 2010 01:58

 Recently I had a request about sending an iCalendar (Meeting Request) object, as the email body itself, rather than as an attachment.(Thanks Paras!)

iCalendars are special attachments that can be used to represent Meeting Requests or Appointments. By default, most mail systems like to have the iCalendar  object as an alternative body. In fact, that is how I wrote aspNetEmail to work. When you can create and add an iCalendar to the EmailMessage object, under the covers, aspNetEmail actually adds it to the internal body parts collection.

Below are 3 code examples. One example demonstrates creating a standard iCalendar enabled  email.  The 2nd example demonstrates creating email that has the iCalendar as the body. The 3rd example offers a combination of the 2.

All 3 of these examples use the following helper method called CreateiCal(…)

Create iCal creates a very simple iCalendar object, that has a meeting set tomorrow at 10am.

public iCalendar CreateiCal()
	iCalendar iCal = new iCalendar(); 
	iCal.ContentTransferEncoding = MailEncoding.Bit7;

	//create an start and end date, tomorrow at 10am, for 1 hr.
	DateTime tomorrow = DateTime.Now.AddDays(1);
	DateTime start = new DateTime( tomorrow.Year, tomorrow.Month, tomorrow.Day, 10,0,0);
	DateTime end = start.AddHours( 1 );

	//set some basic properties
	iCal.Event.Summary.Text = "this is a test ical"; 
	iCal.Event.Location.Text = "100 main conf room"; 
	iCal.Event.DateStart.Date = start; 
	iCal.Event.DateEnd.Date = end; 

	iCal.TimeZone.Format = TimeZoneFormat.ConvertToUTC;

	return iCal;

Example 1
This example demonstrates how to create a standard iCalendar enabled email. This code example will create the iCalender object, and add it to the EmailMessage object. Internally, aspNetEmail actually adds the iCalender to the internal body parts collection. The resulting email will actually have 3 body parts:

a)A Plain Text body part
b)A Html Body Part
c)An iCalendar Body Part

Here is a code example that demonstrates this behavior, along with a screenshot of the resulting email.

public void NormaliCalendar()
	//create a normal EmailMessage object
	//set some basic properties
	EmailMessage msg = new EmailMessage( "" );
	msg.From = "me@example.com";
	msg.To = "you@example.com";
	msg.Subject = "ical test";

	//create the iCalendar object
	iCalendar iCal = CreateiCal(); 

	//add the iCalendar to the EmailMessage object
	msg.AddCalendar( iCal );

	//send it

Notice that in that screenshot, we can have a nicely formatted, easily readable body. By default, aspNetEmail will create this from the properties of the iCalendar. However, the developer can over ride this behavior, and create their own friendly body.

Example 2
Some mail systems don't like to have a 3rd body part. This is typically a smaller subset, has a specialized situation. Instead, these mail systems like to have the entire body of the email actually be the iCalendar. The limitation of this is that some mail systems don't know how to interpret the email message.  This may or may not affect your situation. If you need to have the iCalendar object be the email body, the following code example demonstrates this behavior. Also, found below, is a screenshot of an email that doesn't know how to render this type of format.

public void iCalAsBody()
	//create a normal EmailMessage object
	//set some basic properties
	EmailMessage msg = new EmailMessage( "" );
	msg.From = "me@example.com";
	msg.To = "you@example.com";
	msg.Subject = "ical test";

	//create the iCalendar object
	iCalendar iCal = CreateiCal(); 

	//set the body of the EmailMessage object itself.
	msg.ContentType = "text/Calendar;\r\n\tMethod=\"REQUEST\";";
	msg.Body = 	iCal.ToString( iCalendarType.iCal );

	//send it


Notice that in this screenshot, the email is not easily reable. Also, this iCalendar appears to be missing. This is because the email client (Outlook Express in this example) doesn't know how to render an email, where the body is an iCalender.

Example 3
The 3rd example attempts to offer a combination of both Example 1 and Example 2. By adding a "name" parameter to the Content-Type value, we can get some mail clients to alternatively render the body of the email as an attachment. There really isn't an attachment, but the mail client thinks there is. This allows some mail clients to at least add the iCalendar to their calendaring system.

Below is a code example that demonstrates this, along with a screenshot of the resulting email.

public void iCalAsBodyAndAttachment()
	//create a normal EmailMessage object
	//set some basic properties
	EmailMessage msg = new EmailMessage( "" );
	msg.From = "me@example.com";
	msg.To = "you@example.com";
	msg.Subject = "ical test";

	//create the iCalendar object
	iCalendar iCal = CreateiCal(); 

	//set the body of the EmailMessage object itself.
	//however, the additional Name parameter tricks the 
	//mail client into thinking there is an attachment
	msg.ContentType = "text/Calendar;\r\n\tMethod=\"REQUEST\";\r\n\tName=\"meeting.ics\"";
	msg.Body = 	iCal.ToString( iCalendarType.iCal );
	//send it



Although this email isn't as pretty, by adding the "Name" parameter, it allows the mail client to present the user with an iCal that can be used.

As always, if anyone has any questions, feel free to contact me.

Dave Wanta

Cancel or Update Metting Requests

by Dave 1. October 2010 09:36

One question I often receive about meeting requests is how to update or cancel them.

Can this be done with aspNetEmail?

The short answer is YES! However, there is one small gotcha, you need to keep track of the unique id of the meeting request.

According to the iCalendar specifications, each meeting request needs to have a unique id. By default, aspNetEmail uses a Guid.  aspNetEmail also allows you to over ride this unique id. Whether you create your own, or use aspNetEmail’s, you must keep track of this unique id.

Once you have the unique id of the originally sent iCalendar, you can update or cancel the request at any time in the future. 

Updating an iCalendar
To update a meeting request you will need to do 2 things:
1) Use the same UniqueId as the original. By default, aspNetEmail simply uses a guid for a UniqueId. If you want to, you can just create your own guid, and then record it for later use. For example:
   string uniqueId = Guid.NewGuid().ToString().Replace( "-", string.Empty );
   ical.Event.UniqueId.Value = uniqueId;

Then, just store the uniqueId for any future updates.
Sequence number
2)Youo must also increment the sequence number by 1.
The newer version of aspNetEmail's iCalendar class  has a Sequence property, so you can simply increment it like:
ical.Event.Sequence.Index = 1;
ical.Event.Sequence.Index = 2;

(depending upon how many updates you have issued)

CANCEL an iCalender
To cancel a meeting request, you will again need to do 2 things.
1) You will need to still use the original UniqueId value (just like above)
2)You will need to change the Method of the iCal to CANCEL. Here is what the code looks like:
First Request
string uid = Guid.NewGuid().ToString();
iCalendar ical = new iCalendar();
ical.Event.UniqueId.Value = uid;
//set other properties, add attendees, set organizer...
EmailMessage m = new EmailMessage();
m.AddCalendar( ical );

Cancelled request
//reset the uid
iCalendar ical2 = new iCalendar();
ical2.Event.UniqueId.Value = uid;
//change the method to CANCEL
ical2.Method.Value = "CANCEL";

All Day Events in an iCalendar

by Dave 1. October 2010 09:06

By default, the RFC standard for the iCalendar specification does not support all day events.

However, both Outlook and Lotus Notes support this capability. Both do it a bit differently.

Below is a code example of how to use the iCalendar functionality of aspNetEmail to create all day events in both Lotus Notes and Outlook. 

static void AllDayEvent()
	//create the email message object
	EmailMessage m = new EmailMessage( "" );
	m.From = "me@example.com";
	m.To = "you@blah.com";
	//create an all day event for next week
	DateTime eventDay = DateTime.Now.AddDays(7);

	m.Subject = "all day event for " + eventDay.ToShortDateString();

	//uncomment to create an iCal for Lotus Notes
	//iCalendar iCal= AllDayEventForLotus( eventDay );

	//create an iCal for Outlook
	iCalendar iCal = AllDayEventForOutlook( eventDay );

	//set some event properties
	//set the properties
	iCal.Event.Summary.Text = "Sales Meeting"; 
	iCal.Event.Location.Text = "100 main conf room"; 

	//when we add it to the EmailMessage object, all EmailMessage recipients will
	//be added to the iCalendar *if* the iCalendar does not have any recipients
	//if we wanted to add additional attendees we could use
	//ic.Event.Attendees.Add( ... )

	m.Logging = true;
	m.LogPath = "c:\\email.log";
	m.LogOverwrite = true;

	m.SaveToFile( "c:\\temp\\" );

static iCalendar AllDayEventForLotus(DateTime eventDay)
	iCalendar iCal = new iCalendar(); 

	DateTime start = new DateTime( eventDay.Year, eventDay.Year, eventDay.Day, 4, 0, 0 );
	DateTime end = new DateTime( eventDay.Year, eventDay.Year, eventDay.Day, 20, 0, 0 );

	iCal.Event.DateStart.Date = start;
	iCal.Event.DateEnd.Date = end;
	iCal.Event.Priority.PriorityType = PriorityType.Normal; 

	return iCal;

static iCalendar AllDayEventForOutlook( DateTime eventDay)
	DateTime dayStart = eventDay;
	DateTime dayEnd = eventDay.AddDays( 1 );

	iCalendar iCal = new iCalendar(); 

	iCal.TimeZone.Format = TimeZoneFormat.SuppressTimeZoneRules;

	iCal.Event.DateStart.AddParameter( "VALUE", "DATE:" + dayStart.ToString("yyyyMMdd")  );
	iCal.Event.DateEnd.AddParameter( "VALUE", "DATE:" + dayEnd.ToString( "yyyyMMdd" ) );
	iCal.Event.TimeTransparency.TransparencyType = TransparencyType.Transparent; 

	iCal.Event.Priority.PriorityType = PriorityType.Normal; 

	//set various Outlook X-Headers, so Outlook will recognize it as an All Day Event.
	iCal.Event.Properties.Add( new CustomCalendarProperty( "X-MICROSOFT-CDO-BUSYSTATUS", "FREE" ) );
	iCal.Event.Properties.Add( new CustomCalendarProperty( "X-MICROSOFT-CDO-INSTTYPE", "0" ) );
	iCal.Event.Properties.Add( new CustomCalendarProperty( "X-MICROSOFT-CDO-INTENDEDSTATUS", "FREE" ) );
	iCal.Event.Properties.Add( new CustomCalendarProperty( "X-MICROSOFT-CDO-ALLDAYEVENT", "TRUE" ) );

	return iCal;




Light speed fast response, as always. Thanks "

Webmaster | Find Your Friends

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX IPMuncher aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT