Question

c# api company directory.

  • 27 November 2018
  • 4 replies
  • 1203 views

I'm trying to read in the company directory for our entire organization. I have the following code:


var response = rc.Restapi().Account("~").Directory();

response.Contacts();


When I run this, however, response.Contacts is not present in the returned object. I don't see anything else that looks like a listing of directory contacts.


Obviously I'm not going in the right direction. Can anybody point me down the right path?


4 replies

RingCentral C# API is Async.

Please try await rc.Restapi().Account("~").Directory();  or rc.Restapi().Account("~").Directory().Result;
I tried adding the 'await' to the beginning of the call, but C# gives me an error saying DirectoryPath does not contain a definition for 'GetAwaiter'.  

For Result, I don't see that as an available option under Directory().

Do I need to update my SDK or am I missing a using or something?
Try await rc.Restapi().Account("~").Directory().Contacts().List();   or await rc.Restapi().Account("~").Directory().Contacts().Get();

You can only await on a verb method such as Get/List/Post
Thanks man - that get's me the data.

As an aside, is that constraint about only awaiting verb methods something that RC follows, or is that a general guideline for all webAPI's?

Reply