question

Chaitali avatar image
Chaitali asked ·

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

fax
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.

Anirban Sen Chowdhary avatar image
Anirban Sen Chowdhary answered ·
1 comment Share
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.

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