/
Upload Files to Salesforce Documents
Upload Files to Salesforce Documents
You can create a folder in Salesforce and provide the Folder Id to upload a file:
//create a new document and name it Document document = new Document(); document.Name = string.Concat(mediaItem.DisplayName, ".", mediaItem.Extension); //get the document as a byte array byte[] bytes = ReadFully(mediaItem.GetMediaStream()); document.Body = Convert.ToBase64String(bytes); document.ContentType = mediaItem.MimeType; document.FolderId = "00l60000001JaLm"; document.Description = key; //save the document DocumentService DS = new DocumentService(this.SalesforceSessionInstance); SaveResult saveResult = DS.Insert(document);
Related content
Saving to Salesforce from an MVC form
Saving to Salesforce from an MVC form
Read with this
Attaching Files to a Salesforce Record
Attaching Files to a Salesforce Record
More like this
S4S Code Examples
S4S Code Examples
Read with this
Download Files from Salesforce Attachments
Download Files from Salesforce Attachments
More like this
File Uploads
File Uploads
More like this
Creating Chatter Records with an Attachment
Creating Chatter Records with an Attachment
More like this