0

I want to Manage Device using Google API in my appilcation.How to retrieve all mobile/chrome OS device ?

CODE :

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

Here,

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

I am getting error like

Google.Apis.Requests.RequestError
Bad Request [400] 

I tried using

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

Still not working ? I want all details of User just like Below Image

enter image description here

Manish Goswami
  • 863
  • 10
  • 27

1 Answers1

0

If you check the documentation for Mobiledevices: list

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

I will see that it takes a customer id as a parmater.

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(); 

You are sending service account email address which I really don't think is your customer id.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449