【发布时间】:2019-08-02 16:53:57
【问题描述】:
我正在尝试通过 asp.net 应用程序发送会议请求,然后检查与会者是否接受。
我使用的第一种方法:“发送会议请求”
protected void meetingTest_Click(object sender, EventArgs e)
{
string[] split = User.Identity.Name.Split('\\');
string userTag = split[1];
Active_Directory ad = new Active_Directory();
string creator = ad.convertForUserInfo(userTag, "email");
ExchangeService service = new ExchangeService();
service.AutodiscoverUrl(creator);
Appointment meeting = new Appointment(service);
meeting.Subject = "test";
meeting.Body = "test2";
meeting.Start = DateTime.Now.AddDays(2);
meeting.End = meeting.Start.AddHours(4);
meeting.Location = "test3";
meeting.RequiredAttendees.Add("Attendee´s emailadress");
meeting.ReminderMinutesBeforeStart = 60;
meeting.Save(SendInvitationsMode.SendToAllAndSaveCopy);
checkMeetings();
}
发送部分工作正常,我在 Outlook 中收到了一个会议请求,我可以在其中看到所需的与会者。
现在这里是我获取所需参与者及其状态的方法:
private void checkMeetings()
{
string[] split = User.Identity.Name.Split('\\');
string userTag = split[1];
Active_Directory ad = new Active_Directory();
string creator = ad.convertForUserInfo(userTag, "email");
ExchangeService service = new ExchangeService();
service.AutodiscoverUrl(creator);
CalendarFolder folder = CalendarFolder.Bind(service, WellKnownFolderName.Calendar);
CalendarView view = new CalendarView(Convert.ToDateTime("03.08.2015 08:00"),Convert.ToDateTime("08.08.2015 08:00"));
FindItemsResults<Appointment> results = folder.FindAppointments(view);
foreach (Appointment appointment in results)
{
var attendees = appointment.RequiredAttendees;
Test1.Text += appointment.RequiredAttendees.Count() + "***";
foreach (var attend in appointment.RequiredAttendees)
{
Test2.Text += attend.Name + " " + attend.ResponseType + "***";
}
//Test2.Text += appointment.Subject + "***";
}
}
我现在的问题是,“appointment.RequiredAttendees.count()”为 0,即使我在发送会议请求时添加了一个与会者...
有人知道为什么吗?或者是否有一个更简单的解决方案,我到目前为止还没有找到?
【问题讨论】:
-
sry,我忘了说我是那种东西的新手(asp.net),“会话”是什么意思?
-
会话将数据保存在您的 ASP 中,以防止在页面回发时丢失数据
-
在您的会议中试试这个先生Test_Click 在按钮上添加此代码
Session["Appointment"] = meeting;并在您的检查会议方法调用中为您的会话设置一个值,如meeting = (Appointment)Session["Appointment"];但我在 ASP.net 中也是新的我希望你能明白...... -
我尝试了另一种解决方案,它成功了,将其发布在这里!不过谢谢你的回答
标签: c# asp.net exchangewebservices