如何从Adobe Connect API获取用户的事件列表?

时间:2014-02-17 16:24:52

标签: c# api adobe-connect

我试图获取特定用户注册的事件列表。注意:我可以获取my-events,但之后我需要以用户身份登录:( Adobe Connect API用户指南说明了这一点: Given a user’s login or principal-id, this action returns the list of events that the user attended 现在我获得用户将要参加的活动列表 - 已注册? ...

main()
{
   //login as adiminstrator
   ConnectAPI connectApi = new ConnectAPI(@"http://domain.adobeconnect.com","user@domain.com", "Password", "");
   var listOfEventsJson = getUsersAttendedEvents("someUser@email.com", "someAccountId");
   Console.WriteLine( listOfEventsJson );
}

当我使用

时,我得到一个空的Json列表
private String getUsersAttendedEvents(string login, string accountId)
        {
            if (_bzsession == "")
            Login();
            string queryString = "login=" + login +
                                 "&account-id=" + accountId;
            var result = Request("events-attendance", queryString);
            return JsonConvert.SerializeXmlNode(result, Newtonsoft.Json.Formatting.Indented);
        }

响应结果如下:

{
  "results": {
    "?xml": {
      "@version": "1.0",
      "@encoding": "utf-8"
    },
    "results": {
      "status": {
        "@code": "no-data"
      }
    }
      }
    }

提前致谢

1 个答案:

答案 0 :(得分:0)

我的解决方案是运行thrue所有事件,运行thrue事件后用户和比较用户,你有更好的一个!? Couse这需要时间来运行所有thouse循环: 这是我自己的解决方案:

public List<String> getUserAtendedEvents(String userEmail)
    {
        // get all upcoming Events Sco ID's
        var scoIds = getAllEventsDataToClass().ScoIds;

        List<String> userEvents = new List<string>();

        // request Connect for Event info
        // action=report-event-participants-complete-information&sco-id=1418245799
        for (int i = 0; i < scoIds.Count; i++)
        {
            XDocument req = RequestXDoc("report-event-participants-complete-information", "sco-id=" + scoIds[i]);
            var emails = req.Descendants().Attributes("login"); // ---- login emails

            foreach (var email in emails)
            {
                if (email.Value.Equals(userEmail))
                {
                    userEvents.Add(scoIds[i]);
                }
            }
        }
        return userEvents;

    }