News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
API How to get all Directory entries
Tags: sdk
Apr 10, 2020 at 4:45pm   •   2 replies  •  0 likes
Lev Rakhman

I am getting initial list of of entries:

var resp = await restClient.Restapi().Account("~").Directory().Entries().List(listDirectoryEntriesParameters);

return object has 2 properties: paging object and array of records.

How do I access all pages in response?

2 Answers
answered on Apr 11, 2020 at 6:36am  

Thanks, works perfectly.

One small error. It should be if (response.paging.totalPages >= pageNumber)

Otherwise entries from last page will not be read.


 0
answered on Apr 10, 2020 at 9:47pm  

You can read like this

read_company_directory(-1).Wait();

static private async Task read_company_directory(int pageNumber)
{
  pageNumber++;
  var listDirEntriesParams = new ListDirectoryEntriesParameters();
  listDirEntriesParams.perPage = 300;
  if (pageNumber > 0)
      listDirEntriesParams.page = pageNumber.ToString();
  var response = await rcsdk.Restapi().Account().Directory().Entries().List(listDirEntriesParams);
  Console.WriteLine("Directory");
  Console.WriteLine(JsonConvert.SerializeObject(response.paging));
  if (response.paging.totalPages >= pageNumber)
  {
      read_company_directory(pageNumber).Wait();
  }
}



 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us