using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Exchange.WebServices.Data;
using System.Security.Principal;
using System.Web.Security;
using System.Net;
public partial class Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.AutodiscoverUrl("123@hinet.net");
Appointment appointment = new Appointment(service);
appointment.Subject = "測試發送會議邀約";
appointment.Body = "我是邀約內容";
appointment.Start = new DateTime(2017, 8, 7, 9, 0, 0);
//<--- 邀約時間
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "商城大會議室";
//出席
appointment.RequiredAttendees.Add("123@hinet.net");
appointment.RequiredAttendees.Add("456@com.tw");
//好像是列席
//appointment.OptionalAttendees.Add("發送邀約的 EMail Address");
//如果你有很多個行事曆,可以用下面抓folder id 的方法先抓出 folder id,如參數1 (太長了,為了好閱讀所以截斷了)
//appointment.Save("AAEuAPhprJ+iAAA=", SendInvitationsMode.SendToNone);
//但如果你要新增到自己的行事曆不指定的話可以這樣寫
appointment.Save("SendInvitationsMode.SendToAllAndSaveCopy");
//其他Save方法請參考 http://msdn.microsoft.com/en-us/library/exchange/dd633661(v=exchg.80).aspx
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Exchange.WebServices.Data;
using System.Security.Principal;
using System.Web.Security;
using System.Net;
public partial class Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.AutodiscoverUrl("123@hinet.net");
Appointment appointment = new Appointment(service);
appointment.Subject = "測試發送會議邀約";
appointment.Body = "我是邀約內容";
appointment.Start = new DateTime(2017, 8, 7, 9, 0, 0);
//<--- 邀約時間
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "商城大會議室";
//出席
appointment.RequiredAttendees.Add("123@hinet.net");
appointment.RequiredAttendees.Add("456@com.tw");
//好像是列席
//appointment.OptionalAttendees.Add("發送邀約的 EMail Address");
//如果你有很多個行事曆,可以用下面抓folder id 的方法先抓出 folder id,如參數1 (太長了,為了好閱讀所以截斷了)
//appointment.Save("AAEuAPhprJ+iAAA=", SendInvitationsMode.SendToNone);
//但如果你要新增到自己的行事曆不指定的話可以這樣寫
appointment.Save("SendInvitationsMode.SendToAllAndSaveCopy");
//其他Save方法請參考 http://msdn.microsoft.com/en-us/library/exchange/dd633661(v=exchg.80).aspx
}
}