检查当前用户是否是exchange通讯组列表-Outlook C的成员#

检查当前用户是否是exchange通讯组列表-Outlook C的成员#,outlook,outlook-addin,office-addins,Outlook,Outlook Addin,Office Addins,我想了解当前Outlook用户是否是特定exchange通讯组列表的成员。如果他是,那么他应该看到孩子的形态,如果他不是;然后他会看到消息框 我下面的代码是工作到这一点,如果用户是DistList的成员,他得到子表单,但我不知道如何选中显示他消息框,如果他不是成员 string UserName = (string)application.ActiveExplorer().Session.CurrentUser.Name; stri

我想了解当前Outlook用户是否是特定exchange通讯组列表的成员。如果他是,那么他应该看到孩子的形态,如果他不是;然后他会看到消息框

我下面的代码是工作到这一点,如果用户是DistList的成员,他得到子表单,但我不知道如何选中显示他消息框,如果他不是成员

                string UserName = (string)application.ActiveExplorer().Session.CurrentUser.Name;
                string PersonalPublicFolder = "Public Folders - " + application.ActiveExplorer().Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;
                Outlook.MAPIFolder contactsFolder = outlookNameSpace.Folders[PersonalPublicFolder].Folders["Favorites"];

                Outlook.DistListItem addressList = contactsFolder.Items["ContactGroup"];

                if (addressList.MemberCount != 0)
                {
                    for (int i = 1; i <= addressList.MemberCount; i++)
                    {
                        Outlook.Recipient recipient = addressList.GetMember(i);
                        string contact = recipient.Name;
                        if (contact == UserName)
                        {
                                var assignOwnership = new AssignOwnership();
                                assignOwnership.Show();
                        }
                    }
                }

string UserName=(string)application.ActiveExplorer().Session.CurrentUser.Name;
string PersonalPublicFolder=“Public Folders-”+application.ActiveExplorer().Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;
Outlook.MAPIFolder contactsFolder=outlookNameSpace.Folders[PersonalPublicFolder]。Folders[“收藏夹”];
Outlook.DistListItem addressList=contactsFolder.Items[“ContactGroup”];
如果(addressList.MemberCount!=0)
{

对于(int i=1;iUse
Application.Session.CurrentUser.AddressEntry.GetExchangeUser().GetMemberOfList()
),它将返回包含用户所属的所有DLL的
AddressEntries
对象


准备好处理空值和错误。

您是要处理联系人文件夹中的DL还是Exchange GAL中的DL?您好,Dmitry,Exchange GAL中的Dist list。谢谢Dmitry,非常感谢。