事件访客列表,其中用户组通过访客获取状态 [英] Event guest list with user groups getting status by guest

查看:86
本文介绍了事件访客列表,其中用户组通过访客获取状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为某个日历活动提取来宾的列表,并确定每个来宾的状态(YES,NO,MAYBE),但遇到了用户组的问题。它只给了我的组名和INVITED的状态,但我需要用户组中的每个访客以及他们的邀请状态。这可能吗?

I am trying to pull the list of guests for a calendar event and figure out each of the guests status (YES, NO, MAYBE) but ran into a problem with a user group. It just gives me the group name and a status of INVITED, but I need each guest in the user group and their invite status. Is this possible?

var calendarName="calendar name";
var calDate=new Date("04/02/2013");

function testCalendarEvents(){
var calendars = CalendarApp.getCalendarsByName(calendarName);  
var events = calendars[0].getEventsForDay(calDate); 

for(var c=0; c<events.length; c++){
Logger.log("Event "+c+": "+events[c].getTitle());

var guestList=events[c].getGuestList();    
for(var d=0; guestList!=null && d<guestList.length; d++){
  Logger.log("Guest "+d+": "+guestList[d].getEmail()+", Status: "+guestList[d].getGuestStatus());      
}        
}  
}


推荐答案

目前,这对于DomainGroups来说是不可能的,因为没有应用程序脚本API支持来钻取组成员的状态。根据文档,假设您具有查看组成员的适当权限,您应该能够通过日历UI查看这些用户及其状态。

This is not possible for DomainGroups presently, as there is no apps-script API support for drilling in to the status of group members. According to the documentation, you should be able to view those users and their status through the Calendar UI, assuming that you have appropriate permissions to view group members.

从< href =http://www.google.com/support/enterprise/static/gapps/docs/users/en/learning_center/faqs_calendar.html =nofollow>企业日历常见问题:


我可以邀请我们公司目录中的邮寄名单到会议吗?

是的,您可以邀请我们公司
目录中的任何邮寄名单(组)加入会议。该小组的每位成员都将收到一封电子邮件
邀请。但是,请注意,电子邮件邀请不会显示该组的所有成员。另外,只有您有权限
查看该组的成员列表时,该组成员才会出现在每个与会者日历的
邀请中。

Yes, you can invite any mailing list (group) in our corporate directory to a meeting. Each member of the group will receive an email invitation. Note, however, that the email invitation won't show all the members of the group. Also, the group members will appear in the invitation on each attendee's calendar only if you have permission to view the group's member list.

如果您是域管理员,则可以使用 GroupsManager 服务来检索组的成员列表。不幸的是,在日历事件的背景下,这是您可以做的唯一有用的事情。您无法获取个人用户的邀请状态。我修改了你的脚本来检索成员列表:

If you are a Domain Administrator, you can use the GroupsManager service to retrieve the memberslist of a group. Unfortunately, within the context of a Calendar Event, that's about the only useful thing you can do. You cannot get the invitation status of individual users. I've modified your script to retrieve the member list:

function testCalendarEvents(){
  var calendarName="david_bingham@mitel.com";
  var calDate=new Date("04/01/2013");
  var calendars = CalendarApp.getCalendarsByName(calendarName);  
  var events = calendars[0].getEventsForDay(calDate); 

  try {
    var domainAdmin = false;          // assume we aren't an admin in a domain
    GroupsManager.getGroup("test");
    domainAdmin = true;               // we passed the test, so we ARE
  }
  catch (error) {
    // We didn't pass the test... why not?
    // Get "Service error: : Invalid request URI" if outside of an enterprise account
    // Get "You do not have permission to perform that action." if not admin.
    Logger.log("Not Domain Admin: "+error.message);
  }

  for(var c=0; c<events.length; c++){
    Logger.log("Event "+c+": "+events[c].getTitle());

    var guestList=events[c].getGuestList();    
    for(var d=0; guestList!=null && d<guestList.length; d++){
      if (!domainAdmin) {
        Logger.log("Guest "+d+": "+guestList[d].getEmail()+", Status: "+guestList[d].getGuestStatus());
      }
      else {
        // Check if this guest is a group
        var group = GroupsManager.getGroup(guestList[d].getEmail());
        if (group) {
          // getAllMembers() returns an array of email addresses
          var groupMembers = group.getAllMembers();
          for (var e in groupMembers) {
            Logger.log("Guest "+d+"/"+e+": "+groupMembers[e]+
                       ", Status: "+"UNKNOWN(group "+guestList[d].getEmail()+")");
          }
        }
        else {
          Logger.log("Guest "+d+": "+guestList[d].getEmail()+", Status: "+guestList[d].getGuestStatus());
        }
      }
    }        
  }  
}

这篇关于事件访客列表,其中用户组通过访客获取状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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