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
C# get call logs
Tags: getting started
Nov 30, 2017 at 7:22am   •   1 replies  •  0 likes
keith-stephens

I have a sanbox set up, and I have 2 call logs in it both are missed calls, but I don't think that matters in my case.


What I want to do is return all call logs for all users to display a count of how many Inbound and outbound calls were made by each user.


The code I have in my web page seems to execute fine, but it is not returning any call logs.

[HttpGet]

[Route("api/CallLogs/")]

public async Task<string> GetCallLogs()

{


rc = new RestClient(appKey, appSecret, isProduction);

await rc.Authorize(userName, "", password);

DateTime input = DateTime.Today;

int delta = DayOfWeek.Monday - input.DayOfWeek;

DateTime monday = input.AddDays(delta);


var extension2 = rc.Restapi().Account().Extension();

var callLogs = await extension2.CallLog().List(new { dateFrom = monday.ToString("yyyy-MM-dd") });

//var callLogs = await extension2.CallLog().List(new { direction = "Inbound" });

//var callLogsO = await extension2.CallLog().List(new { direction = "Outbound" });

return callLogs.records.Count().ToString();

}


The count comes back as 0.

But when I go to RC page https://developer.ringcentral.com/api-explorer/latest/index.html#/!/Call_Log/loadCompanyCallLog


And run Get company call logs I get back both of my calls.

Thanks for any help or advice.

Keith.


1 Answer
answered on Nov 30, 2017 at 10:13am  
Hi Keith,

If you want to read call logs from all users, login with the main company account (or extension with admin role). Then call the calllog endpoint at the account level.

var mainAccount = rc.Restapi().Account();
var callLogs = await mainAccount.CallLog().List(new { dateFrom = monday.ToString("yyyy-MM-dd");
...

Let me know if this helps.
+ Phong


 1



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