I am currently creating a Windows Application in C#. Its super basic and "dirty". Requirements:
1. Download all extensions and put in an xls file. 2. Download all call-forwarding and put in an xls file. 3. Upload changes from 2 above 4. Download all caller id and put in an xls file. 5. Upload changes from 4 above. #1 is completed and works marvelously. Here is the basic code:
RestClient rc = new RestClient(_clientId, _clientSecret); await rc.Authorize(_username, _extension, _password); var rcClient = rc.Restapi().Account(); var extensions = await rcClient.Extension().List(); List<ExtensionsClass> exts = new List<ExtensionsClass>(); for(int i=0;i<extensions.records.Count();i++) { ExtensionsClass ext = new ExtensionsClass(); ext.id = extensions.records[i].id; ext.extensionNumber = extensions.records[i].extensionNumber; ext.name = extensions.records[i].name; exts.Add(ext); } DataTable dt = new DataTable();
#2 however I use the following code and the forwarding number always comes back null:
RestClient rc = new RestClient(_clientId, _clientSecret); await rc.Authorize(_username, _extension, _password); var rcClient = rc.Restapi().Account("~"); List<CallFwdRecord> exts = new List<CallFwdRecord>(); foreach (DataRow dr in dt.Rows) { var extn = await rcClient.Extension(dr["id"].ToString()).ForwardingNumber().Get(); //var extensions = await rcClient.Extension(dr["id"].ToString()).ForwardingNumber().Get(); CallFwdRecord ext = new CallFwdRecord(); IList<string> features = new List<string>(); //features = rcClient.F; //ext.features = features; //ext.flipNumber = extensions.records[0].flipNumber; //ext.id = extensions.records[0].id; //ext.label = extensions.records[0].label; //ext.phoneNumber = extensions.records[0].phoneNumber; //ext.uri = extensions.records[0].uri; exts.Add(ext);
}
Ideas?
TIA