/// <summary>Snippet for SearchOrganizationsAsync</summary> public async Task SearchOrganizationsRequestObjectAsync() { // Snippet: SearchOrganizationsAsync(SearchOrganizationsRequest, CallSettings) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) SearchOrganizationsRequest request = new SearchOrganizationsRequest { Query = "", }; // Make the request PagedAsyncEnumerable <SearchOrganizationsResponse, Organization> response = organizationsClient.SearchOrganizationsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Organization item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((SearchOrganizationsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Organization item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Organization> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Organization item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary> /// Searches Organization resources that are visible to the user and satisfythe specified filter. This method returns Organizations in an unspecifiedorder. New Organizations do not necessarily appear at the end of theresults.Search will only return organizations on which the user has the permission`resourcemanager.organizations.get` /// Documentation https://developers.google.com/cloudresourcemanager/v1/reference/organizations/search /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Cloudresourcemanager service.</param> /// <param name="body">A valid Cloudresourcemanager v1 body.</param> /// <returns>SearchOrganizationsResponseResponse</returns> public static SearchOrganizationsResponse Search(CloudresourcemanagerService service, SearchOrganizationsRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Organizations.Search(body).Execute()); } catch (Exception ex) { throw new Exception("Request Organizations.Search failed.", ex); } }