Skip to content

Instantly share code, notes, and snippets.

@wadewegner
Created March 27, 2014 00:26
Show Gist options
  • Select an option

  • Save wadewegner/9797126 to your computer and use it in GitHub Desktop.

Select an option

Save wadewegner/9797126 to your computer and use it in GitHub Desktop.
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
var task = RunProgram();
task.Wait();
}
private static async Task RunProgram()
{
var auth = new AuthenticationClient();
var clientId = "";
var clientSecret = "";
var username = "";
var password = "";
await auth.UsernamePasswordAsync(clientId, clientSecret, username, password);
var client = new ForceClient(auth.InstanceUrl, auth.AccessToken, "v29.0");
var accounts = await client.QueryAsync<Account>("SELECT id, name, description FROM Account");
foreach (var account in accounts.records)
{
Console.WriteLine(account.Name);
}
}
}
public class Account
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment