using Google.Apis.Admin.Directory.directory_v1;
using Google.Apis.Admin.Directory.directory_v1.Data;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.Util.Store;
# code
GroupsResource.ListRequest groupsResourceRequest=service.Groups.List();
groupsResourceRequest.Customer=customer;
IList<Group>g=groupsResourceRequest.Execute().GroupValue;
This method can only fetch up to 200.
When I asked a question on Google's github, there was advice like using Google.Apis.Drive.v3, but I don't know how to connect these two
https://github.com/google/google-api-dotnet-client/issues/905
https://gist.github.com/LindaLawton/0fe663bb9796acd875b676a9f1423a48
Please give me some advice.
c# google-api
I think the link explains that you should issue the request multiple times using the result NextPageToken
.
//Declare a list that summarizes the results of each request because the request is made multiple times.
List<Group>list=new List<Group>();;
string pageToken=null;
while(true)
{
GroupsResource.ListRequest groupsResourceRequest=service.Groups.List();
groupsResourceRequest.Customer=customer;
// In the second and subsequent requests, the previously obtained NextPageToken is set.
groupsResourceRequest.PageToken=pageToken;
Groups groups = groupsResourceRequest.Execute();
IList<Group>g=groups.GroupsValue;
// Add the results of this request to the list.
list.AddRange(g);
// Store PageToken for the next request.
pageToken=groups.NextPageToken;
// If there is no token, the process is finished.
if(string.IsNullOrEmpty(pageToken)||!g.Any())
{
break;
}
}
884 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 Understanding How to Configure Google API Key
596 GDB gets version error when attempting to debug with the Presense SDK (IDE)
606 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.