question

Brian Ford avatar image
Brian Ford asked Brian Ford answered

MMS C# Error

I'm following the tutorial at https://ringcentral-tutorials.github.io/sms-api-csharp-demo/?distinctId=201757107#3

Everything work fine when sending the Sms message but when I try the Mms example I get as compile error stating "Argument 2: cannot convert from 'RingCentral.Attachments[]' to 'RingCentral.RestRequestConfig'. The error is on line 56 of the above tutorial:

var resp = await rc.Restapi().Account().Extension().Sms().Post(parameters, attachments);

Anyone know the solution to this?

mms
1 |1500 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

The tutorial was created using the old .Net SDK.

Using the current SDK, please modify the code as follows

var parameters = new CreateMMSMessage();
parameters.from = new MessageStoreCallerInfoRequest { phoneNumber = fromNumber };
parameters.to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = RECIPIENT } };
parameters.text = "Hello World from C#";
var attachment = new Attachment { fileName = "test.jpg", contentType = "image/jpeg", bytes = File.ReadAllBytes("test.jpg") };
parameters.attachments = new Attachment[] { attachment };
var resp = await rc.Restapi().Account().Extension().Mms().Post(parameters);


1 |1500 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.

Brian Ford avatar image
Brian Ford answered

Thank you, I will give that try :)

1 |1500 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.

Brian Ford avatar image
Brian Ford answered

That did it, thank you so much

1 |1500 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.

Customer Spaces

Work together.
From anywhere.

Team messaging, video meetings
and phone - all in one app.


Get the new RingCentral app