简体   繁体   English

通过 JavaScript 从 Outlook 获取通讯组列表

[英]Get distribution list from Outlook via JavaScript

In Outlook, I have 7 Groups where my email id.在 Outlook 中,我的电子邮件 ID 有 7 个组。 I need to get the group names (only name of the group not members of the group) where my email id.我需要获取我的电子邮件 ID 所在的组名称(仅组名称,而不是组成员)。 Group Names are: "Team A", "Team B" etc. Currently I can get group count.组名是:“Team A”、“Team B”等。目前我可以得到组数。

var theMailItem = outLookApp.CreateItem(0);
//Count number of groups: which returns me 7
var test = theMailItem.Session.CurrentUser.AddressEntry.GetExchangeUser.GetMemberOfList.Count;
for (var i = 0; i < test; i++) {
   alert(test[i].Name);
}

Above code always return null.上面的代码总是返回空值。 I want only 7 groups names like "Team A", "Team B" etc.我只想要 7 个组名称,例如“Team A”、“Team B”等。

Firstly, all collections in OOM are 1 based, not 0.首先,OOM 中的所有集合都是基于 1 的,而不是 0。

Secondly, your "test" variable is an int, so test[i] makes no sense.其次,你的“测试”变量是一个整数,所以test[i]没有意义。

Thirdly, you can use a much simpler loop:第三,您可以使用更简单的循环:

var dl = outLookApp.Session.CurrentUser.AddressEntry.GetExchangeUser().GetMemberOfList();
for (var i = 1 ; i < dl.count; i++)
{
   alert(dl.Item(i + 1).Name);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM