【问题标题】:Retrieving all Users using Google Apps Provisioning API?使用 Google Apps Provisioning API 检索所有用户?
【发布时间】:2013-10-22 08:59:15
【问题描述】:

我正在尝试检索域中的所有用户,但它永远不会起作用。我的代码从未出现任何错误。

我在我的项目中添加 Google.GData.Apps.dll 作为参考。我正在使用 Google Apps 配置 API。我指的是这些链接https://developers.google.com/google-apps/provisioning/

代码:-

    string domain = @"<domain name>";
    string subs = @"<Authorization code>";

    AppsService appService = new AppsService(domain, subs);

   // appService.CreateUser("john.jain","James","anderson","james@1234");
   // appService.DeleteUser("Amitesh");

    appService.RetrieveAllUsers();

【问题讨论】:

    标签: c# google-api google-apps


    【解决方案1】:

    以下对我有用 - RetrieveAllUsers() 返回一个包含所有用户的 UserFeed 对象。请注意,我为应用程序服务使用了不同的构造函数(使用用户名/密码凭据而不是 OAuth)。

    this.appsService = new AppsService(credential.Domain, credential.Username, credential.Password); UserFeed userFeed = this.appsService.RetrieveAllUsers(); // 选择除域超级管理员之外的所有用户。 var usernamesInDomain = (来自 userFeed.Entries 中的 UserEntry 用户 其中 user.Login.Admin != true 选择 user.Login.UserName).ToList();

    在您的案例中,返回的 UserFeed 对象包含什么?

    【讨论】:

      【解决方案2】:

      这是我的解决方案:-

      Google.GData.Apps.UserFeed s = appService.RetrieveAllUsers();
      
      
      
        foreach (UserEntry s1 in s.Entries)
        {
      
            string username = s1.Login.UserName.ToString();
        }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-08-09
        • 1970-01-01
        • 2012-11-24
        • 1970-01-01
        相关资源
        最近更新 更多