Created
March 27, 2014 00:26
-
-
Save wadewegner/9797126 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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