Sending Outlook meeting requests without Outlook.docx
《Sending Outlook meeting requests without Outlook.docx》由会员分享,可在线阅读,更多相关《Sending Outlook meeting requests without Outlook.docx(15页珍藏版)》请在冰豆网上搜索。
SendingOutlookmeetingrequestswithoutOutlook
SendingOutlookmeetingrequestswithoutOutlook?
IjustwonderifitispossibletosendMeetingRequeststopeoplewithouthavingOutlookinstalledontheServerandusingCOMInterop(whichIwanttoavoidonaserveratallcosts).
WehaveExchange2003inaWindows2003DomainandallusersaredomainUsers.IguessIcansend'roundiCal/vCalorsomething,butIwonderifthereisaproperstandardwaytosendMeetingRequeststhroughExchangewithoutOutlook?
ThisisC#/.netifitmatters.
ThewaytosendameetingrequesttoOutlook(andhaveitrecognized)goeslikethis:
∙prepareaniCalendarfile,besuretosettheseadditionalproperties,asOutlookneedsthem:
∙UID
∙SEQUENCE
∙CREATED
∙LAST-MODIFIED
∙DTSTAMP
∙prepareamultipart/alternativemail:
∙Part1:
text/html(orwhateveryoulike)-thisisdisplayedto"ordinary"mailreadersorasafall-backandcontainsasummaryoftheeventinhumanreadableform
∙Part2:
text/calendar;method=REQUEST,holdsthecontentsoftheicsfile(theheadermethodparametermustmatchthemethodintheics).Watchoutforthecorrecttextencoding,declaringacharsetheaderparameterwon'thurt.
∙Part3:
Optionally,attachthe.icsfileitself,soordinarymailreaderscanoffertheusersomethingtoclickon.Outlookdoesnotreallyrequiretheattachmentbecauseitjustreadsthetext/calendarpart.
∙Sendthemailtoanoutlookuser.Ifyougoteverythingrightthemailshowsupasameetingrequest,completewithattendancebuttonsandautomaticentryintheuserscalendaruponaccept.
∙Setupsomethingthatprocessestheresponses(theygotothemeetingorganizer).IhavenotyetbeenabletogetautomaticattendeetrackingtoworkwithanExchangemailboxbecausetheeventwon'texistintheorganizerscalendar.OutlookneedstheUIDsandSEQUENCEStomatchit'sexpectations,butwithaUIDyoumadeupthiswillhardlywork.
Forhelponthedetailsandpeculiaritiesoftheicsfileformat,besuretovisittheiCalendarSpecificationExcerptsbyMasahideKanzaki.Theyarealightinthedark,muchbetterthangnawingyourwaythroughRFC2445.Butthenagain,maybeahandylibraryexistsfor.NET.
sendingoutlookmeetingrequestthroughapplication
Hi,Ithinkyouoptionsare;1.createandICSfileontheserverthattheuserdownloads.(manyeventsitedothis).2.IfyouhaveexchangeyoucanuseExchangeDAVorEWStocreateansendmeetingrequest.(thisitproballytheeasiest)SowhatdoyouhaveinyourENVwhatkindofexperianceareyoulookingfor?
isthisjustforoutlookusersetc.– 76melMar30'10at10:
17
As76melsuggestedanICSfilewillcreateanOutlookcalendarevent(orforanycalendarapplicationthatsupportsiCal)-thereprettysimple-justneedtowriteatextfilewithanICSextensionandamimetypeof"text/calendar":
BEGIN:
VCALENDAR
VERSION:
2.0
PRODID:
YourAppName
METHOD:
PUBLISH
BEGIN:
VEVENT
DTSTART:
20100401T000000Z
DTEND:
20100401T000000Z
LOCATION:
Somewhere
UID:
MeetingId
DTSTAMP:
20100330T225528Z
DESCRIPTION:
MeetingTitle
SUMMARY:
MeetingDescription
END:
VEVENT
END:
VCALENDAR
CreateOutlookTaskRequestfromASP.NET
1downvotefavorite
I'mlookingforawaytocreateOutlookTaskRequestfromASP.NET.I'musingExchangeServer2003foremailserver.Basically,userofmyASP.NETapplicationwilldosomethingthatwillcreateOutlookTaskbasedonsomelogic.Isthisnativelysupportedin.NETormustIusethirdpartycomponent?
Introduction
I�mgoingtoshowtwodifferentwaysofsendingtasksprogrammatically.OneisusingtheMicrosoftOutlook11.0ObjectLibraryandtheotherisusingvCalendar.
UsingMicrosoftOutlook11.0ObjectLibrary
ThesimplestoftheseisusingMicrosoft11.0objectlibrary.ThishasaclasscalledTaskItem.TaskItemrepresentsatask(anassigned,delegated,orself-imposedtasktobeperformedwithinaspecifiedtimeframe)inaTasksfolder.Likeappointmentsormeetings,taskscanbedelegated.YoucangetthislibraryfromAddReferenceandclickonCOMtab.
Createanaliasasfollows:
Collapse|CopyCode
usingOutlook=Microsoft.Office.Interop.Outlook;
CreateobjectsofApplicationClassandTaskItemasfollows:
Collapse|CopyCode
Outlook.ApplicationClassapp=newOutlook.ApplicationClass();
Outlook.TaskItemtsk=(Outlook.TaskItem)
app.CreateItem(Outlook.OlItemType.olTaskItem);
Setthepropertiesoftaskasneeded:
Collapse|CopyCode
tsk.StartDate=DateTime.Now;
tsk.DueDate=DateTime.Now;
tsk.Subject="Test";
tsk.Body="TestingTask";
tsk.Recipients.Add("abc@");
tsk.Assign();
tsk.Send();
That�sit.Thisisthesimplestwayforcreatingandsendingataskprogrammatically.Onedisadvantageofthisiswegettoclickawaytheannoyingsecuritypopups.
UsingvCalendar
ThenextwayisthroughthevCalendarobject.vCalendaristheindustrystandardformatforsending/receivingschedulinginformationelectronically.vCalendarwasdevelopedbyaconsortiumformedbyIBM,AT&T,SiemensandApple.Later,thisspecificationwasgiventoInternetMailConsortium.Now,mostofthePersonalInformationManager(PIM)programsonallsoftwaresupportvCalendarasthestandardexchangeformat.
MicrosoftOutlooksupportsvCalendar(whatmoredowewant;)).vCalendarfilesarenotjustusedtoexchangeappointmentsandscheduleswithinoneorganization.Theycanbeusedtoscheduleappointmentswithothers,whouseschedulingsoftwareincompatiblewithyours(allthemorewewant,right?
).Let�sgetonwithhowtocreateavCalendarobjectprogrammatically.
vCalendarfilewouldlooksomethinglikethefollowing:
Collapse|CopyCode
BEGIN:
VCALENDARPRODID:
-//MicrosoftCorporation//OutlookMIMEDIR//EN
VERSION:
1.0BEGIN:
VEVENTDTSTART:
19980114T210000ZDTEND:
19980114T230000Z
LOCATION:
TeamRoomCATEGORIES:
Business
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:
Testing
Task=0D=0ASUMMARY:
TestPRIORITY:
3END:
VEVENTEND:
VCALENDAR
TocreatethevCalendarobject,wehavethemethodgivenbelow:
Collapse|CopyCode
stringCreateTask(DateTimestart,DateTimeend,stringsub,stringmsgBody)
{
StringBuildersbvCalendar=newStringBuilder();
//Header
sbvCalendar.Append("METHOD:
REQUEST");
sbvCalendar.Append("\n");
sbvCalendar.Append("BEGIN:
VCALENDAR");
sbvCalendar.Append("\n");
sbvCalendar.Append("PRODID:
-//MicrosoftCorporation//Outlook");
sbvCalendar.Append("\n");
sbvCalendar.Append("MIMEDIR//ENVERSION:
1.0");
sbvCalendar.Append("\n");
sbvCalendar.Append("BEGIN:
VEVENT");
sbvCalendar.Append("\n");
//DTSTART
sbvCalendar.Append("DTSTART:
");
stringhour=start.Hour.ToString();
if(hour.Length<2){hour="0"+hour;}
stringmin=start.Minute.ToString();
if(min.Length<2){min="0"+min;}
stringsec=start.Second.ToString();
if(sec.Length<2){sec="0"+sec;}
stringmon=start.Month.ToString();
if(mon.Length<2){mon="0"+mon;}
stringday=start.Day.ToString();
if(day.Length<2){day="0"+day;}
sbvCalendar.Append(start.Year.ToString()+mon+day
+"T"+hour+min+sec);
sbvCalendar.Append("\n");
//DTEND
sbvCalendar.Append("DTEND:
");
hour=end.Hour.ToString();
if(hour.Length<2){hour="0"+hour;}
min=end.Minute.ToString();
if(min.Length<2){min="0"+min;}
sec=end.Second.ToString();
if(sec.Length<2){sec="0"+sec;}
mon=end.Month.ToString();
if(mon.Length<2){mon="0"+mon;}
day=end.Day.ToString();
if(day.Length<2){day="0"+day;}
sbvCalendar.Append(end.Year.ToString()+mon+
day+"T"+hour+min+sec);
sbvCalendar.Append("\n");
//Location
sbvCalendar.Append("LOCATION;ENCODING=QUOTED-PRINTABLE:
"
+String.Empty);
sbvCalendar.Append("\n");
//Messagebody
sbvCalendar.Append("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:
"
+msgBody);
sbvCalendar.Append("\n");
//Subject
sbvCalendar.Append("SUMMARY;ENCODING=QUOTED-PRINTABLE:
"
+sub);
sbvCalendar.Append("\n");
//Priority
sbvCalendar.Append("PRIORITY:
3");
sbvCalendar.Append("\n");
sbvCalendar.Append("END:
VEVENT");
sbvCalendar.Append("\n");
sbvCalendar.Append("END:
VCALENDAR");
sbvCalendar.Append("\n");
returnsbvCalendar.ToString();
}
Wecanusethismethodas:
Collapse|CopyCode
stringsub="Test";
stringbody="TestingTask";
//Createamessageobject
MailMessagemsg=newMailMessage();
msg.From="abc@";
msg.To="def@";
msg.Subject=sub;
msg.BodyEncoding=System.Text.Encoding.UTF8;
msg.Body=body;
//Setthedate/time
DateTimestart=DateTime.Parse("Jan1,2005");
DateTimeend=DateTime.Parse("Jan2,2005");
DateTimeex=DateTime.Now;
//LocationwhereyouwanttosavethevCalendarfile
stringattachUrl=
"C:
\Inetpub\wwwroot\WebApplication3\bin\Test.vcs";
//Createtask
using(StreamWritersw=newStreamWriter(attachUrl)
{
sw.Write(CreateTask(start,end,sub,body));
}
//Attachthetask
MailAttachmentmAttachment=newMailAttachment(attachUrl);
msg.Attachments.Add(mAttachment);
//Send
SmtpMail.SmtpServer="some-smtp-mail-";
SmtpMail.Send(msg);
That�sit.Happycoding!
SendCalendarAppointmentAsEmailAttachment
Introduction
Icameacrossascenariowhereameeting/visitschedulehadtobesetinanaspxpageandthesameschedulehadtobesentacrossasacalendarinviteinanemail.Thecalendarfilewastobeanattachmentintheemail.Thisarticlegivesabriefdescriptionoftheproceduretocreateanoutlookcalendarappointment(.ics)fileandsenditthroughemailasanattachmentandalsotocheckifthemethodworkedwithoutactuallyhavingtoconfiguretheSMTPservertosendthemail.
Steps:
Letusdividethissectioninto3broadparts:
ToCreateanOutlookcalendar(.ics)file.
ToAttachthefiletoanEmailme