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
String Error C# Call Log
Tags: getting started
Apr 15, 2019 at 5:02pm   •   1 replies  •  0 likes
eric-lisciandrello

Good evening,

Probably an absolute obvious answer and newb answer. But I am attempting to code our own call log pulls in C# but starting off with the tutorial version, and currently I am testing our API's out in the Console version. I am switching from Power BI to a WPF Application. As I go to pull our company call-logs, I am trying to specify the OUTBOUND direction only, but I keep receiving a "CS0029 - Cannot implicitly convert type 'string' to 'string[]'. Below is the code I am trying to alter.





using System;

using System.Threading.Tasks;

using RingCentral;



namespace Read_CallLog

{


class Program

{


const string RINGCENTRAL_CLIENTID = "MYID#";

const string RINGCENTRAL_CLIENTSECRET = "MYSECRET";


const string RINGCENTRAL_USERNAME = "12345678910";

const string RINGCENTRAL_PASSWORD = "PASSWORD";

const string RINGCENTRAL_EXTENSION = "EXTENSION";


static void Main(string[] args)

{


Read_user_calllog().Wait();

Console.ReadLine();

}

static private async Task Read_user_calllog()

{




RestClient rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, true);

await rc.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);


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


if (rc.token.access_token.Length > 0)

{



var resp = await mainAcct.CallLog().List(new LoadCompanyCallLogParameters

{


perPage = 100,

direction = "Outbound",

type = "Voice"

});


foreach (CallLogRecord record in resp.records)

{


if (record.direction == "Outbound")

{


Console.WriteLine("Call type: " + record.type + " / " + record.from.extensionNumber);

}

}


}

}

}

}

1 Answer
answered on Apr 15, 2019 at 5:15pm  
Where's your error occuring? In the part where you're generating the request? Because I think the request parameters call for an array (due to having multiple cases) Setting a string array is pretty straight forward. Try this: new string[] { "Outbound" }; Now you wouldn't be able to do a string == string[] for a comparison because they're not the same type

 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