Skip to main content
New Participant
February 23, 2020
Question

Downloading fax attachment

I am working on C# platform and exploring it. I am trying to use Fax api and trying to download the fax attachment content in the code. I can see I get the binary data as output as response of the API once I input the message and attachment id:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/accountId/extension/extensionId/message-store/messageId/content/attachmentId


    1 reply

    The First Step
    February 23, 2020

    You can check the following:

    RestClient rc = new RestClient("ClientID", "ClientSecret", false); 
    await rc.Authorize("username", "extensionNumber", "password"); ... 
    var extension = rc.Restapi().Account().Extension(); 
    var messages = response.records; 
    // fax var message = messages.Where(m => m.type == "Fax" && m.messageStatus != "SendingFailed" && m.attachments != null && m.attachments.Length > 0).Skip(3).First(); 
    var content = await extension.MessageStore(message.id).Content(message.attachments[0].id).Get(); 
    System.IO.File.WriteAllBytes("filename.ext", content.data);

    ref: https://stackoverflow.com/questions/52486470/how-to-view-download-the-sent-fax-using-ringcentral-fax-api-c-sharp

    full code reference: https://github.com/ringcentral/ringcentral-csharp-client/blob/master/RingCentral.Test/BinaryTest.cs