在 .NET 应用程序中检索所有移动设备 Google 目录 API

Retrieve all mobile devices Google Directory API in .NET Application

我想在我的 appilcation.How 中使用 Google API 管理设备以检索所有 mobile/chrome OS 设备?

代码:

var listReq1 = service.Mobiledevices.List(serviceAccountEmail);
 MobileDevices allUsers = listReq1.Execute(); 

这里,

serviceAccountEmail = "Service accounts Key" (Console.developer.google.com)

我收到类似

的错误
Google.Apis.Requests.RequestError
Bad Request [400] 

我尝试使用

var listReq= new Google.Apis.Admin.Directory.directory_v1.MobiledevicesResource.ListRequest(service,serviceAccountEmail);

还是不行?我想要用户的所有详细信息,就像下面的图片

如果您查看 Mobiledevices: list

的文档

Retrieves a paginated list of all mobile devices for an account.

我会看到它以客户 ID 作为参数。

customerId
The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customerId. The customerId is also returned as part of the Users resource.

var listReq1 = service.Mobiledevices.List(customerId);
MobileDevices allUsers = listReq1.Execute(); 

您发送的服务帐户电子邮件地址我真的不认为是您的客户 ID。