How to connect to Salesforce / SForce with C#?
Step 1 – Download and import the wsdl (sorry no steps for this here yet).
Step 2 – Use the following code example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace SforceConnection
{
public class Program
{
static void Main(string[] args)
{
SforceService service = new SforceService();
LoginResult loginResult = new LoginResult();
string username= "youruser@yourdomain.tld";
string password= "P@sswd!";
service.Timeout = 60000;
loginResult = service.login(username, password);
service.Url = loginResult.serverUrl;
service.SessionHeaderValue = new SessionHeader();
service.SessionHeaderValue.sessionId = loginResult.sessionId;
// Do something you are now connected
}
}
}
