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 names and call count from call logs
Tags: getting started
Nov 30, 2017 at 11:05am   •   1 replies  •  0 likes
keith-stephens

I got a c# web app, which I am now getting call logs returned to me but how do I loop through the results and just get the name of the person who made the call and a count of how many calls they made.

Here is my code so far.


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

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

var mainAccount = rc.Restapi().Account();

DateTime input = DateTime.Today;

int delta = DayOfWeek.Monday - input.DayOfWeek;

DateTime monday = input.AddDays(delta);


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

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

string id = string.Empty;

var query = callLogs.records.SelectMany(x => x.from.name)

.GroupBy(s => s)

.Select(g => new { Name = g.Key, Count = g.Count() });

//var query = callLogs.records.SelectMany(x => x.id)

// .GroupBy(s => s)

// .Select(g => new { Name = g.Key, Count = g.Count() });

foreach (var result in query)

{


Console.WriteLine("Name: {0}, Count: {1}", result.Name, result.Count);

}


Thanks for helping,

Keith.


1 Answer
answered on Nov 30, 2017 at 11:42am  
Hi Keith,

The name will not be shown if the call is not from the same the account. See more from API reference.
Symbolic name associated with a party. If the phone does not belong to the known extension, only the location is returned, the name is not determined then.
If you want to get the name of a user, you have to call the company directory contact list and match the number with the number from the contact list to identify the name. To specify only users (extensions from your account) who made outgoing calls, you can shorten the call log result by set the direction to OutBound.

Hope this helps!
+ Phong

 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