惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
博客园_首页
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
博客园 - 司徒正美
有赞技术团队
有赞技术团队
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog

博客园 - microsoft_xin

用户属性数据库设计:如何平衡固定信息与灵活扩展? mysql数据库千万级数据量是分库分表好还是数据归档好 MySQL 优化实战:为何 DELETE + IN 子查询性能不佳,而 JOIN 却能高效利用索引? git的还原提交和撤销提交可以帮你快速回滚提交和推送 java语法使用小技巧-保留两位小数-用group对list数据分组取和 java时间常用功能工具类 Navicat或DBeaver连接MySql提示错误 Unable to load authentication plugin ‘caching_sha2_password‘ 快速测试连接SQLServer数据库的方法 nlog使用小记(日志文件分割备份循环) IDEA常用快捷键 java中两个list集合取并集、交集和差集&对list数据进行对象属性筛选 Cron表达式及格式适用于各种调度服务quartz xxljob hangfire C#客户端实现域环境内Windows认证免密码自动身份认证登录 .NET List常见操作之交集并集差集(转) mysql-查看最近执行sql脚本 SharePoint安装 OpenID Connect、SAML、WS-Federation和/或OAuth2.0 SQLServer常用SQL脚本 使用VSTO创建修改和删除outlook会议加载项(一)
使用VSTO创建修改和删除outlook会议加载项(二)
microsoft_xin · 2022-10-12 · via 博客园 - microsoft_xin

使用VSTO创建修改和删除outlook会议加载项

获取组织者的电子邮件地址类似xxx@163.com:

var organizer = appointment.GetOrganizer();
string organizerAddress = GetEmailAddress(organizer.PropertyAccessor);
ConfigManager.PRSMTPAddress = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E";
public static string GetEmailAddress(PropertyAccessor pa)
{
    string PR_SMTP_ADDRESS = ConfigManager.PRSMTPAddress;
    string emailAddress = pa.GetProperty(PR_SMTP_ADDRESS).ToString();
    return emailAddress;
}

修改会议并发送,包括组织者或参会者转发会议:

public bool EditTencentMeeting(_MeetingItem meetingItem,AppointmentItem appointment)
{
    string sendEmailAddress = meetingItem.SendUsingAccount.SmtpAddress;            
    string organizerEmail = ScheduleMeeting.GetEmailAddress(appointment.GetOrganizer().PropertyAccessor);
    EditMeetingRequestModel requestModel = GetRequestModel(appointment);
    requestModel.OrganizerEmail = organizerEmail;
    if (sendEmailAddress.ToLower() == organizerEmail.ToLower())
    {
        //说明是组织者更新
        List<Invitees> listInvitees = GetInvitees(appointment.Recipients);
        requestModel.Recipients = listInvitees;
        requestModel.IsOrganizer = 1;
        return EditTencentMeeting(requestModel);
    }
    else
    {
        //说明是参会人更新
        //取出参会人本次邀请的参会人
        List<Invitees> listInvitees = GetInvitees(meetingItem.Recipients);
        requestModel.Recipients = listInvitees;
        requestModel.IsOrganizer = 0;
        return EditTencentMeeting(requestModel);
    }
}

获取参会人:

private List<Invitees> GetInvitees(Recipients recipients)
{
    List<Invitees> listInvitees = new List<Invitees>();
    foreach (var p in recipients)
    {
        if (p is Recipient recipient)
        {
            Invitees invitee = new Invitees();
            invitee.Email = ScheduleMeeting.GetEmailAddress(recipient.PropertyAccessor);
            var checkUser = listInvitees.Where(x => x.Email.ToLower() == invitee.Email.ToLower());
            if (checkUser != null && checkUser.Any())
            {
                continue;
            }
            invitee.Mode = EmailMode.User;
            if (recipient.DisplayType == OlDisplayType.olOrganization)
            {
                invitee.Mode = EmailMode.Org;
            }
            listInvitees.Add(invitee);
        }
    }
    return listInvitees;
}

需要注意的是:如果是参会人张三转发的会议,此处的参会人列表只包含张三收到会议时的参会人,组织者和参会人(包括张三本次转发邀请的参会人)后来邀请的参会人都不在该列表中,但是组织者转发会议则会包含所有的参会人。