Skip to main content
The First Step
March 4, 2021
Solved

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?

    PhongVu
    PhongVuAnswer
    Community Manager
    March 5, 2021

    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);


    3 replies

    PhongVu
    Community Manager
    PhongVuAnswer
    Community Manager
    March 5, 2021

    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);


    The First Step
    March 5, 2021

    Thank you, I will give that try :)

    The First Step
    March 5, 2021

    That did it, thank you so much