// Hope this helps someone I know I struggled with using the api initially.
// Import the Ring Central Client api into VS using nuget first.
using System;
using System.Linq;
using RingCentral;
namespace ringCentralLogs
{
class Program
{
static void Main(string[] args)
{
Conn();
Console.ReadLine();
}
static async void Conn()
{
try
{
RestClient rc = new RestClient("ClientId", "ClientSecret");
// Authorize the user.
await rc.Authorize("Sandbox User ID", "", "Password");
// Get the main account.
var account = rc.Restapi().Account();
// Retrieve the call log records using some selection criteria.
var callLogs = await account.CallLog().List(new { direction = "Outbound", type = "Fax", dateFrom = "2018-03-10T18:07:52.534Z"});
Console.WriteLine("Print the call log");
// Convert the callLogs.records to a list.
var query = callLogs.records.ToList();
// Iterate over the list printing properties.
foreach (var result in query)
{
Console.WriteLine("StartTime: {0} To: {1} Direction: {2} Type: {3} Result: {4}",result.startTime,result.to.phoneNumber, result.direction, result.type, result.result);
}
// Revoke the token.
await rc.Revoke();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return;
}
}
}
// Import the Ring Central Client api into VS using nuget first.
using System;
using System.Linq;
using RingCentral;
namespace ringCentralLogs
{
class Program
{
static void Main(string[] args)
{
Conn();
Console.ReadLine();
}
static async void Conn()
{
try
{
RestClient rc = new RestClient("ClientId", "ClientSecret");
// Authorize the user.
await rc.Authorize("Sandbox User ID", "", "Password");
// Get the main account.
var account = rc.Restapi().Account();
// Retrieve the call log records using some selection criteria.
var callLogs = await account.CallLog().List(new { direction = "Outbound", type = "Fax", dateFrom = "2018-03-10T18:07:52.534Z"});
Console.WriteLine("Print the call log");
// Convert the callLogs.records to a list.
var query = callLogs.records.ToList();
// Iterate over the list printing properties.
foreach (var result in query)
{
Console.WriteLine("StartTime: {0} To: {1} Direction: {2} Type: {3} Result: {4}",result.startTime,result.to.phoneNumber, result.direction, result.type, result.result);
}
// Revoke the token.
await rc.Revoke();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return;
}
}
}