Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Using a Contact Record as an Example


The type of file is typically a Word doc, PDF, xls, etc. You need to create an attachment and set its Parent ID to the ID of the Salesforce object that you are linking it to. Be aware the attachment body needs to be a byte array. Please Google converting different types of documents to a byte array using C# 


ContactService contactService = new ContactService(salesforceSession);
 
//This is the Id for a contact directly from the browsers address bar
Id contactId = new Id("00390000001TjMHAA0");
 
Contact contact = contactService.GetByEntityId(contactId, new SObjectField[] {Contact.Fields.Id, Contact.Fields.FirstName, Contact.Fields.LastName});
Assert.IsNotNull(contact);
Assert.AreEqual(contactId, contact.Id);
  • No labels