question

Chaitali avatar image
Chaitali asked Phong Vu answered

Sending PDF through fax with C#

Hi,

I am exploring ringcentral fax. I want to send PDF file attachment with rc fax through C# code.

Any example or pointer will be a great help

Thanks

getting started
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.

Anirban avatar image
Anirban answered Chaitali commented
1 comment
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.

ok.. thanks

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered

Instead of using the c-sharp SDK, which is obsolete, I recommend you to use the latest .Net SDK. And follow the example code below to send a fax.

// set the last param to true for production
RestClient rc = new RestClient("clientId", "clientSecret", false);
await rc.Authorize("username", "extensionNum", "password");
if (rc.token.access_token.Length > 0)
{
  var requestParams = new CreateFaxMessageRequest();
  var attachment = new Attachment { fileName = "test.jpg", contentType = "image/jpeg", bytes = System.IO.File.ReadAllBytes("test.jpg") };
  var attachments = new Attachment[] { attachment };
  requestParams.attachments = attachments;
  requestParams.to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = RECIPIENT } };
  requestParams.faxResolution = "High";
  requestParams.coverPageText = "This is a demo Fax page from C#";
  var resp = await rc.Restapi().Account().Extension().Fax().Post(requestParams);
  Console.WriteLine("Fax sent. Message status: " + resp.messageStatus);
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.

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