通过 JavaScript 从 Outlook 获取通讯组列表 [英] Get distribution list from Outlook via JavaScript

查看:53
本文介绍了通过 JavaScript 从 Outlook 获取通讯组列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Outlook 中,我的电子邮件 ID 有 7 个组.我需要获取我的电子邮件 ID 所在的组名称(仅组名称,而不是组成员).组名是:Team A"、Team B"等等.目前我可以得到组数.

In Outlook, I have 7 Groups where my email id. I need to get the group names (only name of the group not members of the group) where my email id. Group Names are: "Team A", "Team B" etc. Currently I can get group count.

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);
}

以上代码总是返回空值.我只想要 7 个组名,例如Team A"、Team B";等

Above code always return null. I want only 7 groups names like "Team A", "Team B" etc.

推荐答案

首先,OOM 中的所有集合都是基于 1,而不是 0.

Firstly, all collections in OOM are 1 based, not 0.

其次,你的test"变量是一个 int,所以 test[i] 没有意义.

Secondly, your "test" variable is an int, so test[i] makes no sense.

第三,您可以使用更简单的循环:

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);
}

这篇关于通过 JavaScript 从 Outlook 获取通讯组列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆