Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.


Build status

An easy-to-use .NET client library for Salesforce REST API


  • Create, Update, Delete and Query records.
  • FindById for finding records easily.
  • GetRawContent to get raw string results.
  • GetRawBytes to get raw bytes results, useful for working with blobs.
  • SalesforceAttribute (Ignore, IgnoreUpdate and FieldName).
  • Authentication flows
    • UsernamePasswordAuthenticationFlow
    • Others authentication flows can be added by implementing IAuthenticationFlow.
  • Mono support
  • Fully tested on Windows and OSX
  • 100% Unit Tests coveraged
  • 100% code documentation
  • FxCop validated
  • Good (and well used) design patterns


PM> Install-Package SalesforceSharp



var client = new SalesforceClient();
var authFlow = new UsernamePasswordAuthenticationFlow(clientId, clientSecret, username, password);

catch(SalesforceException ex)
	Console.WriteLine("Authentication failed: {0} : {1}", ex.Error, ex.Message);

Querying records

public class Account
    public string Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }


var records = client.Query<Account>("SELECT id, name, description FROM Account");

foreach(var r in records)
	Console.WriteLine("{0}: {1}", r.Id, r.Name);

Finding a record by Id

var record = client.FindById<Account>("Account", "<ID>");

Creating a record

// Using a class. 
client.Create("Account", new Account() 
{ Name = "name created", Description = "description created" }));

// Using an anonymous.
client.Create("Account", new { Name = "name created", Description = "description created" }));

Updating a record

// Using a class. Ever required property should be set.
client.Update("Account", "<record id>", new Account() 
{ Name = "name updated", Description = "description updated" }));

// Using an anonymous. Only required properties will be updated.
client.Update("Account", "<record id>", new { Description = "description updated" }));

Deleting a record

client.Delete("Account", "<ID">);


Having troubles?


  • Implements others authentcation flows:
    • Web server flow, where the server can securely protect the consumer secret.
    • User-agent flow, used by applications that cannot securely store the consumer secret.

How to improve it?


Licensed under the The MIT License (MIT). In others words, you can use this library for developement any kind of software: open source, commercial, proprietary and alien.

You can’t perform that action at this time.