Skip to main content

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);

}

}


}

}

}

}

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

Reply