 |
|
Asp.net ขอความช่วยเหลือ เรื่องส่งวันที่ประชุมเข้า Outlook แล้ว Auto Accept แล้วเข้าไปแสดงในปฏิทินเลยครับ |
|
 |
|
|
 |
 |
|
ขอความช่วยเหลือ เรื่องส่งวันที่ประชุมเข้า Outlook 2013 แล้ว Auto Accept แล้วเข้าไปแสดงในปฏิทินเลยครับ
ตอนนี้ทำได้แต่แนบไฟล์ไปแล้วต้องกดเปิดไฟล์ และบันทึก ถึงจะเข้าไปในปฏิทิน
(ผมใหม่มาก)
CODE VB.NET
Code (VB.NET)
Imports System.Net.Mail
Imports System.Net
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim schLocation As String = "Conference Room"
Dim schSubject As String = "Business visit discussion"
Dim schDescription As String = "Schedule description"
Dim schBeginDate As System.DateTime = Convert.ToDateTime("18/2/2017 10:00:00 PM")
Dim schEndDate As System.DateTime = Convert.ToDateTime("18/2/2017 11:00:00 PM")
'PUTTING THE MEETING DETAILS INTO AN ARRAY OF STRING
Dim contents As [String]() = {"BEGIN:VCALENDAR", "PRODID:-//Flo Inc.//FloSoft//EN", "BEGIN:VEVENT", "DTSTART:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\THHmmss\Z"), "DTEND:" + schEndDate.ToUniversalTime().ToString("yyyyMMdd\THHmmss\Z"), Convert.ToString("LOCATION:") & schLocation, _
Convert.ToString("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:") & schDescription, Convert.ToString("SUMMARY:") & schSubject, "PRIORITY:3", "END:VEVENT", "END:VCALENDAR"}
System.IO.File.WriteAllLines(Server.MapPath("Sample.ics"), contents)
SendMail()
End Sub
Public Sub SendMail()
Dim FromName As String = "TestNameFrom"
Dim FromEmail As String = "[email protected]"
Dim ToName As String = "TestNameTo"
Dim ToEmail As String = "[email protected]"
Dim smtp As System.Net.Mail.SmtpClient = New SmtpClient()
smtp.EnableSsl = False
Dim mailMessage As New System.Net.Mail.MailMessage()
mailMessage.From = New System.Net.Mail.MailAddress(FromEmail, FromName)
mailMessage.[To].Add(New System.Net.Mail.MailAddress(ToEmail, ToName))
mailMessage.Subject = "Outlook calendar as attachment"
mailMessage.Body = "This is a test message."
Dim mailAttachment As New Attachment(Server.MapPath("Sample.ics"))
mailMessage.Attachments.Add(mailAttachment)
smtp.Send(mailMessage)
Response.Write("ส่งสำเร็จ")
End Sub
End Class
Config
Code (VB.NET)
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="domain.xxxxxxxxxx.com"
port="25"
enableSsl="true"
userName="[email protected]"
password="xxxxxxxxx"
defaultCredentials="false" />
</smtp>
</mailSettings>
</system.net>
Tag : .NET, Web (ASP.NET), VB.NET, Office
|
|
 |
 |
 |
 |
Date :
2017-02-07 17:14:43 |
By :
chanainut |
View :
794 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับบ
|
 |
 |
 |
 |
Date :
2017-02-08 11:01:17 |
By :
chanainut |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|