Peter,
Thank you for your response. However I am not running Webdav and we do not
have Exchange in our enironment.
Below is the code that I have so far. This creates the ics file and places
it as an attachment to an email. However it does not send the email as a
meeting request. It simply sends the email with an attachment. I think I need
to change something in the emails header to make the receiving email client
recognise that it is being sent a meeting request not an email. I am not
quite sure how or what though and that is my question...
Public Function SendAppoinment(ByVal Method As String, ByVal startDate
As String, _
ByVal startTime As String, ByVal endTime As String,
ByVal subject As String, _
ByVal summary As String, ByVal location As String, ByVal
attendeeName As String, _
ByVal attendeeEmail As String, ByVal organizerEmail As
String, _
ByVal organizerName As String, ByVal emailBody As
String, ByVal GUID As String) As Boolean
Const c_strTimeFormat = "yyyyMMddTHHmmssZ"
Dim sStartTime As String = ""
Dim sEndTime As String = ""
Dim sTimeStamp As String = ""
Dim sTempStartTime As String = ""
Dim sTempEndTime As String = ""
Dim sCalendarFile As String = ""
Const VCAL_FILE = "BEGIN:VCALENDAR" & vbCrLf & _
"VERSION:2.0" & vbCrLf & _
"METHOD{0}" & vbCrLf & _
"BEGIN:VEVENT" & vbCrLf & _
"STATUS{1}" & vbCrLf & _
"DTSTART{2}" & vbCrLf & _
"DTEND{3}" & vbCrLf & _
"TRANSP:OPAQUE" & vbCrLf & _
"SEQUENCE:0" & vbCrLf & _
"LOCATION;ENCODING=QUOTED-PRINTABLE:{4}" & vbCrLf
& _
"ORGANIZER;CN=""{5}/OHA"":mailto:{6}" & vbCrLf & _
"UID : {7}" & vbCrLf & _
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:{8}" &
vbCrLf & _
"CLASS:PUBLIC" & vbCrLf & _
"SUMMARY;ENCODING=QUOTED-PRINTABLE:{9}" & vbCrLf & _
"TRIGGER:-PT15M" & vbCrLf & _
"PRIORITY:3" & vbCrLf & _
"END:VEVENT" & vbCrLf & _
"END:VCALENDAR"
Dim sMethod As String = ":" & Method
Dim sStatus As String = ":CONFIRMED"
Dim dtStartDate As DateTime = DateTime.Parse(startDate.ToString())
Dim dtStartTime As DateTime = DateTime.Parse(startDate + " " +
startTime.ToString())
Dim dtEndTime As DateTime = DateTime.Parse(startDate + " " +
endTime.ToString())
sTempStartTime = String.Format("{0} {1}",
dtStartDate.ToShortDateString(), dtStartTime.ToLongTimeString())
sTempEndTime = String.Format("{0} {1}",
dtStartDate.ToShortDateString(), dtEndTime.ToLongTimeString())
sTimeStamp =
(DateTime.Parse(sTempStartTime)).ToUniversalTime() .ToString(c_strTimeFormat)
sStartTime = String.Format(":{0}", sTimeStamp)
sEndTime = String.Format(":{0}",
(DateTime.Parse(sTempEndTime)).ToUniversalTime().T oString(c_strTimeFormat))
sCalendarFile = String.Format(VCAL_FILE, sMethod, sStatus,
sStartTime, sEndTime, location, organizerName, organizerEmail, GUID, summary,
subject)
' Create the mail message
Dim mail As MailMessage = New MailMessage()
Dim sc As SmtpClient
Dim maTo As MailAddress = New MailAddress(attendeeEmail.Trim(),
attendeeName)
Dim maFrom As MailAddress = New MailAddress(organizerEmail.Trim(),
organizerName)
mail = New MailMessage(maFrom, maTo)
mail.Subject = subject
mail.Body = emailBody
' create the attachment by converting the text to a byte array and
placing it in a
' memory stream object
Dim bAttach() As Byte = Encoding.ASCII.GetBytes(sCalendarFile)
Dim msAttach As New System.IO.MemoryStream(bAttach)
Dim aAttach As Attachment = New Attachment(msAttach, "Event.ics")
mail.Attachments.Add(aAttach)
sc = New SmtpClient(ConfigurationManager.AppSettings("Email Server"))
sc.Send(mail)
Return True
End Function
Regards,
James
""Peter Huang" [MSFT]" wrote:
Hi all,
Based on my research so far, I found that we can use WebDAV to send Meet
Request directly.
If the information is stored in the VCalendar file, I think we may parse
the VCalendar(it is a text file) and got the required information and
sending the meeting request directly with WebDav.
Here is a KB for your reference.
308373 How to send a meeting request by using WebDAV
http://support.microsoft.com/default...b;EN-US;308373
Although it is in VB6, but the key point in WebDav is to send the HTTP
Request to the Exchange Server.
In VB6, we use XMLHTTP library, but in .NET, we have a similar class
HTTPWebRequest which did the same job.
Here is another KB about how to send work with WebDAV in .NET via
HTTPWebRequest.
313121 How to create an Outlook Calendar folder by using WebDAV in Visual C#
http://support.microsoft.com/default...b;EN-US;313121
313128 How to send an e-mail message by using WebDAV in Visual C#
http://support.microsoft.com/default...b;EN-US;313128
314198 How to use the HttpWebRequest class and the HttpWebResponse class to
modify the properties of an object in Visual Basic .NET
http://support.microsoft.com/default...b;EN-US;314198
If you have any other concern, please feel free to let me know.
Best regards,
Perter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.