question

rick-smith2386 avatar image
rick-smith2386 asked ·

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?




General Topic
1 |1000 characters needed characters left characters exceeded

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 ·
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 |1000 characters needed characters left characters exceeded

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

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 ·
> 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 |1000 characters needed characters left characters exceeded

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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