Force.com-Toolkit-for-NET icon indicating copy to clipboard operation
Force.com-Toolkit-for-NET copied to clipboard

Is it possible to retrieve an attachment in the Body

Open AlicePain opened this issue 9 years ago • 0 comments

I'm able to save and update attachments via the Attachment model. I can view the documents in salesforce, but I cannot retrieve the attachments. Using the following code

var client = await SalesforceService.GetUserNamePasswordForceClientAsync(); var att = await client.QueryByIdAsync<Models.Attachment>("Attachment", param.Id);

The following error is thrown "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."

I believe this error is occurring in JsonConvert.DeserializeObject - and I believe it's possible salesforce is replacing some of the base64 chars which would be invalid to send over http.

Unfortunately I can't seem to figure out how to fix this.

Adding the actual Base64 text from salesforce, it's short. var s = Convert.FromBase64String("dGhpcyBpcyBhIHRlc3QgZmlsZSE=");

This works and it seems the Base64 is correctly formatted.

AlicePain avatar Jan 06 '17 17:01 AlicePain