CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 1/4/2008 6:01:15 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 32 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
NickKA
Asp.Net User
Problem Emailing Outlook Calendar Event1/4/2008 6:01:15 PM

0/0

I am trying to email a Calendar Event to myself. I folowed the way Microsoft says to do it here: http://msdn2.microsoft.com/en-us/library/bb655909.aspx

 The only difference is that I am using a memory stream and not a Response.Write.

I will show my code but let me expain the problem first.

When I do this the following it doesn't really show as a valid attachment. it does show the number of bytes of the attachment.

reminderMsg.Attachments.Add(new Attachment(mStream, "Add2Calendar.ics", @"text/calendar"));

When I do the following it appears to be a valid attachment but when I click on it I get "The file cannot be previewed because there is no previewer installed for it".

reminderMsg.Attachments.Add(new Attachment(mStream, "Add2Calendar.ics",MediaTypeNames.Text.Plain));

I know this all works in my Outlook because I have received email calendar attachement before.

Show I use "text/calendar"or MediaTypeNames.Text.Plain? Any help will be appreciated.

Here is my code:

MemoryStream mStream = new MemoryStream();

StreamWriter writer = new StreamWriter(mStream);

writer.AutoFlush = true;

writer.WriteLine("BEGIN:VCALENDAR");

writer.WriteLine("VERSION:2.0");

writer.WriteLine("PRODID:-//ICSTestCS/");

writer.WriteLine("CALSCALE:GREGORIAN");

// Define time zones.

// US/Eastern

writer.WriteLine("BEGIN:VTIMEZONE");

writer.WriteLine("TZID:US/Eastern");

writer.WriteLine("BEGIN:STANDARD");

writer.WriteLine("DTSTART:20071104T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11");

writer.WriteLine("TZOFFSETFROM:-0400");

writer.WriteLine("TZOFFSETTO:-0500");

writer.WriteLine("TZNAME:EST");

writer.WriteLine("END:STANDARD");

writer.WriteLine("BEGIN:DAYLIGHT");

writer.WriteLine("DTSTART:20070311T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3");

writer.WriteLine("TZOFFSETFROM:-0500");

writer.WriteLine("TZOFFSETTO:-0400");

writer.WriteLine("TZNAME:EDT");

writer.WriteLine("END:DAYLIGHT");

writer.WriteLine("END:VTIMEZONE");

// US/Central

writer.WriteLine("BEGIN:VTIMEZONE");

writer.WriteLine("TZID:US/Central");

writer.WriteLine("BEGIN:STANDARD");

writer.WriteLine("DTSTART:20071104T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11");

writer.WriteLine("TZOFFSETFROM:-0500");

writer.WriteLine("TZOFFSETTO:-0600");

writer.WriteLine("TZNAME:CST");

writer.WriteLine("END:STANDARD");

writer.WriteLine("BEGIN:DAYLIGHT");

writer.WriteLine("DTSTART:20070311T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3");

writer.WriteLine("TZOFFSETFROM:-0600");

writer.WriteLine("TZOFFSETTO:-0500");

writer.WriteLine("TZNAME:CDT");

writer.WriteLine("END:DAYLIGHT");

writer.WriteLine("END:VTIMEZONE");

// US/Mountain

writer.WriteLine("BEGIN:VTIMEZONE");

writer.WriteLine("TZID:US/Mountain");

writer.WriteLine("BEGIN:STANDARD");

writer.WriteLine("DTSTART:20071104T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11");

writer.WriteLine("TZOFFSETFROM:-0600");

writer.WriteLine("TZOFFSETTO:-0700");

writer.WriteLine("TZNAME:MST");

writer.WriteLine("END:STANDARD");

writer.WriteLine("BEGIN:DAYLIGHT");

writer.WriteLine("DTSTART:20070311T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3");

writer.WriteLine("TZOFFSETFROM:-0700");

writer.WriteLine("TZOFFSETTO:-0600");

writer.WriteLine("TZNAME:MDT");

writer.WriteLine("END:DAYLIGHT");

writer.WriteLine("END:VTIMEZONE");

// US/Pacific

writer.WriteLine("BEGIN:VTIMEZONE");

writer.WriteLine("TZID:US/Pacific");

writer.WriteLine("BEGIN:STANDARD");

writer.WriteLine("DTSTART:20071104T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11");

writer.WriteLine("TZOFFSETFROM:-0700");

writer.WriteLine("TZOFFSETTO:-0800");

writer.WriteLine("TZNAME:PST");

writer.WriteLine("END:STANDARD");

writer.WriteLine("BEGIN:DAYLIGHT");

writer.WriteLine("DTSTART:20070311T020000");

writer.WriteLine("RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3");

writer.WriteLine("TZOFFSETFROM:-0800");

writer.WriteLine("TZOFFSETTO:-0700");

writer.WriteLine("TZNAME:PDT");

writer.WriteLine("END:DAYLIGHT");

writer.WriteLine("END:VTIMEZONE");

// Define the event.

writer.WriteLine("BEGIN:VEVENT");writer.WriteLine("DTSTART;TZID=" + "Mountain" + ":");

writer.WriteLine(evt.StartTime.Year.ToString());

writer.WriteLine(FormatDateTimeValue(evt.StartTime.Month));

writer.WriteLine(FormatDateTimeValue(evt.StartTime.Day) +
"T");

writer.WriteLine(evt.StartTime.ToShortTimeString());

writer.WriteLine(
"DTEND;TZID=" + "Mountain" + ":");

writer.WriteLine(evt.EndTime.Year.ToString());

writer.WriteLine(FormatDateTimeValue(evt.EndTime.Month));

writer.WriteLine(FormatDateTimeValue(evt.EndTime.Day) +
"T");

writer.WriteLine(evt.EndTime.ToShortTimeString());

writer.WriteLine(
"SUMMARY:" + evt.Title);

writer.WriteLine("DESCRIPTION:" + evt.Description);

writer.WriteLine("UID:1");

writer.WriteLine("SEQUENCE:0");

writer.WriteLine("DTSTAMP:" + dtNow.Year.ToString());

writer.WriteLine(FormatDateTimeValue(dtNow.Month));

writer.WriteLine(FormatDateTimeValue(dtNow.Day) +
"T");

writer.WriteLine(FormatDateTimeValue(dtNow.Hour));

writer.WriteLine(FormatDateTimeValue(dtNow.Minute) +
"00");

writer.WriteLine("END:VEVENT");

writer.WriteLine("END:VCALENDAR");

Configuration configurationFile = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/Web.Config");

System.Net.Configuration.MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as System.Net.Configuration.MailSettingsSectionGroup;

MailMessage reminderMsg = new System.Net.Mail.MailMessage(mailSettings.Smtp.From, recipient);

reminderMsg.Subject = "Calendar Event";

reminderMsg.Body = "I won't show the body";

reminderMsg.IsBodyHtml = true;

reminderMsg.Priority = System.Net.Mail.MailPriority.Normal;

reminderMsg.Attachments.Add(new Attachment(mStream, "Add2Calendar.ics", @"text/calendar"));

 

reminderMsg.Headers.Add(
"Content-Type", @"text/calendar");

reminderMsg.Headers.Add("content-disposition", "attachment; filename=Add2Calendar.ics");

System.Net.Mail.SmtpClient scMail = new System.Net.Mail.SmtpClient(mailSettings.Smtp.Network.Host, mailSettings.Smtp.Network.Port);

try

{

scMail.Send(reminderMsg);

}

catch (SmtpFailedRecipientsException ex)

{

//divError.InnerText = "The message did not reeach all intended recipients.";

}

1 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Absolute Beginner's Guide to Microsoft Office 2003 Authors: Jim Boyce, Pages: 479, Published: 2003
Big Book of Windows Hacks Authors: Preston Gralla, Pages: 647, Published: 2007
Microsoft Office 2003 All-in-one: All-in-one Authors: Joseph W. Habraken, Pages: 951, Published: 2004
Troubleshooting Microsoft Outlook 2002 Authors: Don Gilbert, Julia Kelly, Pages: 316, Published: 2002
Using Microsoft Office Outlook 2003 Authors: Patricia Cardoza, Patricia DiGiacomo, Pages: 1040, Published: 2003
How to Do Everything with Microsoft Office Outlook 2003 Authors: Bill Mann, William P. Mann, Pages: 472, Published: 2003
How to Do Everything with Microsoft Office 2003 Authors: Laurie Ann Ulrich, Pages: 456, Published: 2003
Sharepoint 2007: The Definitive Guide Authors: James Pyles, Christopher M. Buechler, Bob Fox, Murray Gordon, Michael Lotter, Jason Medero, Pages: 794, Published: 2007
Open Source Solutions for Small Business Problems Authors: John Locke, Pages: 556, Published: 2004
Microsoft Outlook 2007 Bible Authors: Peter G. Aitken, Pages: 594, Published: 2007

Web:
Outlook Export/Outlook Add-in to Export Outlook Calendar, Contact ... Outlook Export allows users to easily export calendar events, contacts and email items to various formats for use in other applications. ...
CoolerEmail - Opt-In Email Marketing May 14, 2003 ... If you used Microsoft Outlook and wanted to add this event to your calendar, ... To create an Outlook calendar event for inclusion in your ...
Outlook: Emailing an Outlook Calendar Here’s how to send your Outlook calendar to someone by email. ... Related Events Storage Consolidation for Your Microsoft Applications: Reducing Cost and ...
Calendar Tools for Outlook 3StepShare, 3StepShare is designed to facilitate the sharing of Outlook folders (calendar, contact, task and email) without the need for Exchange, ...
Terminally Incoherent » Blog Archive » Generate Outlook Calendar ... Apr 14, 2008 ... Generate Outlook Calendar Events with PHP and iCalendar .... the same problem - sending email invites to Outlook via our java application. ...
Email Outlook Calendar Events to Blackberry - BlackBerryForums.com ... Right now his calendar is in my outlook on my desktop. ... I would like to email him each event. Only problem is that I have no idea how. ...
Outlook Calendar Sync Problem - The iPhone Blog Forums The email works just fine. The calendar will show events I have put ... sync with Outlook on my PC... it does not seem that calendar events ...
outlook calendaring Problem emailing calendar item in Outlook 2007 Problem emailing calendar item in Outlook 2007 - hblai ... Most of it seems to be working ok, but I can not email a calendar event I schedule. ...
Fix It: Outlook Calendar and iPhone Calendar Events Hours Not ... Aug 27, 2008 ... Basically, his iPhone was showing all of his Outlook events 1 hour .... I just Googled the problem and found this thread ...it fixed the ...
Emailing Calendar Info in Outlook 2007 - Productivity Portfolio Feb 10, 2008 ... The problem is this feature needed Microsoft Exchange. With Outlook 2007, you can quickly send your calendar to someone else using email. ...




Search This Site:










problem understanding form and post method...

restricting 14 days after present day on calendar component

weeknumber in calendar control

redirecting to another pages and printing out values???

web controls events

link 2 asp pages

problems with events and autopostback

try/catch and transaction questions

weird error

cannot find control id in panel control?

how can i know if a user pressed a key

sending email using a form

checkbox validation

displaying the .net framwork & mdac versions on an aspx webpage

problem with try and catch "response.redirect ....."

how can i change a buttons shape from its default rectangular shape to a cylindrical shape

looking for an incremental search combo box

right click menu

specified argument was out of the range

checkbox - select only one

required field validator does not function.

problem in user defined progress bar control

session variables loosing their values upon postback

how to check for password length?

main page becomes blank after opening a pdf file

deleting all records in datagrid that uses paging

how to come ture a shopping cart?

how can i create a vcalendar file using vb.net and data from my webform

richedit control

how to call one function written in global.asax file from .aspx pages?

  Privacy | Contact Us
All Times Are GMT