0

I am not able to attach excel(.xls) file in "notes and attachments" section in the specific record in Salesforce using c#. I am a beginner in salesforce. I will appreciate any kind of help. Thank you in advance.

Here's the code:

const string qry = "SELECT ID, Name FROM Contact";
var result = await forceClient.QueryAsync<Contact>(qry);
byte[] inbuff = File.ReadAllBytes(@"file");
dynamic attach = new ExpandoObject();
attach.Body = inbuff;
attach.Name = "Test5" + ".xls";
attach.IsPrivate = false;
var createResults = await forceClient.CreateAsync("Contact", attach);

I am getting this type of error:

"No such column 'Body' on sobject of type Contact

1
  • 1
    forceClient.CreateAsync("Attachment", attach); use attachment instead of contact Aug 12 '16 at 9:42
0

You need to update this line

forceClient.CreateAsync("Attachment", attach);

use attachment instead of contact

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.