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

        }
    }
}

2 Comments

  1. To location a bet, bettors ought to show up in particular person at
    a brick-and-mortar casino with a valid ID to prove they are legally
    of age.

    Also visit my blog post :: 메이저사이트

  2. willige Telefonsex Frauen says:

    Hello, perfect for sharing the information here.
    This site is totally awesome!

    Thanks

Leave a Reply

How to post code in comments?