question

Benny Dadon avatar image
Benny Dadon asked Benny Dadon commented

MMS

Getting error in sending MMS:

IOException: The process cannot access the file 'C:\Users\DELL\Source\Repos\CosmeticsOms\Oms.Web\wwwroot\files\RingCentral\test_4e28.jpg' because it is being used by another process.

MY CODE:

var attachment = new Attachment { fileName = model.FileName, contentType = imageType, bytes = System.IO.File.ReadAllBytes(filePathCopy) };

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered Benny Dadon commented

Seems the file is being open by another program in your computer. This may have nothing to do with the SDK or the API. Double check it and try.

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Benny Dadon avatar image Benny Dadon commented ·

Thanks for reply I just upload file into folder then access file into attachment.

var imageType = "";

if (model.UploadedFile != null)

{

var directoryPath = Path.Combine(_env.WebRootPath, localDirectoryPath);

var uniqueFileName = GetUniqueFileName(model.UploadedFile.FileName);

imageType = model.UploadedFile.ContentType;


var filePath = Path.Combine(directoryPath, uniqueFileName);

model.UploadedFile.CopyTo(new FileStream(filePath, FileMode.Create));

model.FileName = uniqueFileName;

model.FilePath = localDirectoryPath + model.FileName;

}


var parameters = new CreateSMSMessage();

parameters.from = new MessageStoreCallerInfoRequest { phoneNumber = ringCentralCredentials.Username };

parameters.to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = model.ReceiptNumber } };

parameters.text = model.Message;

var filePathCopy = "wwwroot/" + model.FilePath;

var attachment = new Attachment { fileName = model.FileName, contentType = imageType, bytes = System.IO.File.ReadAllBytes(filePathCopy) };

0 Likes 0 ·

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