OutLook会议室预定提醒

项目组采用敏捷开发管理,每两周一个迭代。写个工具做会议室预定。

代码下载:https://download.csdn.net/download/linmilove/10547579

AppointmentItem agendaMeeting = (AppointmentItem)new Microsoft.Office.Interop.Outlook.ApplicationClass().CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
agendaMeeting.MeetingStatus = OlMeetingStatus.olMeeting;

agendaMeeting.Location = localtion[0];
agendaMeeting.Subject = string.Format("{0} {1:yyyy-MM-dd} {2}", txtSubject.Text, dtpStart.Value, agendaMeeting.Location);
agendaMeeting.Body = txtBody.Text;
agendaMeeting.Start = dtpStart.Value;
agendaMeeting.End = dtpEnd.Value;

Recipient recipient = agendaMeeting.Recipients.Add(localtion[1]);
recipient.Type = (int)OlMeetingRecipientType.olRequired;
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
var match = regex.Matches(txtRecipients.Text);
foreach (System.Text.RegularExpressions.Match item2 in match)
{
    agendaMeeting.Recipients.Add(item2.Value);
}
((_AppointmentItem)agendaMeeting).Send();
Thread.Sleep(3000);
AppointmentItem appt = (new Microsoft.Office.Interop.Outlook.ApplicationClass()).Session
    .GetDefaultFolder(OlDefaultFolders.olFolderCalendar).Items.Find(string.Format("[Subject]='{0}'", agendaMeeting.Subject)) as AppointmentItem;
if (appt != null)
{
    bool isDeclined = false;
    foreach (Recipient recip in appt.Recipients)
    {
        if (recip.Name.Contains("会议室") && recip.MeetingResponseStatus == OlResponseStatus.olResponseDeclined)
        {
            //预定失败
            isDeclined = true;
            break;
        }
    }
    if (!isDeclined)
    {
        break;
    }
}

界面预览:

 

转载于:https://www.cnblogs.com/ssda/p/9326469.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值