0

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

我在我的项目中添加 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();
4

2 回答 2

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 对象包含什么?

于 2013-10-22T12:24:29.133 回答
0

这是我的解决方案:-

Google.GData.Apps.UserFeed s = appService.RetrieveAllUsers();



  foreach (UserEntry s1 in s.Entries)
  {

      string username = s1.Login.UserName.ToString();
  }
于 2013-10-22T12:49:24.713 回答