我试图让我的C#Web应用程序使用他们的API登录RingCentral . 我是新手使用Web API,不知道如何使用RC . 我查看了他们的文档,但我没有成功 . https://github.com/ringcentral/ringcentral-csharp-client
我知道我的工作,因为我可以登录他们的门户网站,而我的所有密钥都没有改变 .
我在添加“await”关键字时收到的第一个错误是它想要将我的方法从Page_Load更改为“async”方法 . 其次是页面继承应该是System.web.ui.page还是Ringcentral.page?
最后,我希望能够登录和检索入站和出站呼叫日志,并在gridview中显示它们 .
我正在使用VS 2017,它是一个Web Forms应用程序 . 我没有选择MVC或Web API . 我甚至无法突破一个突破点 .
public partial class _Default : Page
{
//https://github.com/ringcentral/ringcentral-csharp-client
private static String appKey = ConfigurationManager.AppSettings["appKey"].ToString();
private static String appSecret = ConfigurationManager.AppSettings["appSecretKey"].ToString();
private static bool isProduction = Convert.ToBoolean(ConfigurationManager.AppSettings["IsProduction"].ToString());
private static String userName = ConfigurationManager.AppSettings["username"].ToString();
private static String extension = ConfigurationManager.AppSettings["extension"].ToString();
private static String password = ConfigurationManager.AppSettings["password"].ToString();
private RestClient rc = null;
protected async void Page_LoadAsync(object sender, EventArgs e)
{
rc = new RestClient(appKey, appSecret, isProduction);
await rc.Authorize(userName, extension, password);
}
}
Web应用程序的示例Web应用程序或存根代码将非常有用 . 谢谢,KSS
1 回答
有关使用RingCentral C# Client SDK的示例Web应用程序,请参阅以下使用Nancy Web框架(http://nancyfx.org/)的OAuth Auth Code演示 .
https://github.com/ringcentral/ringcentral-demos-oauth/tree/master/csharp-nancy