question

rick-smith2386 avatar image
rick-smith2386 asked Tyler Liu answered

C# Sending SMS thows System.UriFormatException: 'Invalid URI: The format of the URI could not be determined.'

Trying to send a simple SMS with this code it throws

public void SendText()

{


//This throws System.UriFormatException: 'Invalid URI: The format of the URI could not //be determined.' at this point

var sdk = new SDK(appkey, appSecret, "SDK.Server.Sandbox", " MyApp", "1.0.0");

var jsonString = "{ \"text\": \"TryThis RC!\", \"from\": { \"phoneNumber\": \"+15558881212\" }, \"to\": [{ \"phoneNumber\": \"+18008675309\" }] }";

var request = new Request("/restapi/v1.0/account/~/extension/~/sms", jsonString);

var response = sdk.Platform.Post(request);


}


What am I doing wrong?





sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered John Wang Deactivated commented
Hi Rick,

Not sure what SDK do you use. Please refer to our official SDK for C-Sharp and use it to access RingCentral Platform. Have a look at the sample code for sending SMS

Hope this helps,
+ Phong 
2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

rick-smith2386 avatar image rick-smith2386 commented ·
Hi Phong
Im using v4.0.30319 is that deprecated? The code Im seeing via the above URL is completely different?  Furthermore the code seems to be wrong??

This does not work in vs2017
rc = new RestClient("clientId", "clientSecret");

Any Ideas?


Thanks
Rick

UPDATE
Code on this page https://github.com/ringcentral/ringcentral-csharp-client is completely wrong as far as I can tell. Does your product even work with C# and VS2017?

0 Likes 0 ·
John Wang avatar image John Wang ♦♦ commented ·
> Code on this page  https://github.com/ringcentral/ringcentral-csharp-client is completely wrong as far as I can tell. Does your product even work with C# and VS2017?

This works with C#. Travis CI runs the following C# tests with each commit:

https://github.com/ringcentral/ringcentral-csharp-client/tree/master/RingCentral.Test

You can see the Travis CI builds here:

https://travis-ci.org/ringcentral/ringcentral-csharp-client/builds

While the latest cron build failed and needs to be investigated, you can see that the code works in general for the previous builds.
0 Likes 0 ·
Tyler Liu avatar image
Tyler Liu answered
Hi Rick,

Last month I created a video for how to setup a new project. Please watch this:  https://www.youtube.com/watch?v=lECKMrX_Dgw&t=10s
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys