Reply
Visitor
Haridharan
Posts: 1
0

Add attachment for new contact in c#

Hi,

 

We need to add an attachment for new contact. We are creating using APEX class for adding new contact. We are able create new contact. we need to maintain the Order information for a contact. This is not possible with the available fields/custom fields. So we are going to try with attachment. a customer may have multiple orders.

Can you please let me know how to add attachment for a contact using c#.

 

Please find the below code snippet:

 

Contact newContact = new Contact();


newContact.LastName = downloadInformation.Name;
newContact.Email = downloadInformation.Email;

try
{
SforceService salesForce = new SforceService();
MySFServiceService mySFServive = new MySFServiceService();
mySFServive.SessionHeaderValue = new SForce.MyService.SessionHeader();

LoginResult loginResult = salesForce.login("id", "password");
mySFServive.SessionHeaderValue.sessionId = loginResult.sessionId;
// UserRegistration is a method defined in our apex class.
// parametter 1: contact object parameter
// 2: account name

mySFServive.UserRegistration(newContact, "Test Account");

catch (Exception ex)
{
}