• hk2012
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi All,

I am trying to fetch my contact details but unable to do so
Below is my sample code
//create auth client to retrieve token
            var auth = new AuthenticationClient();

            //get back URL and token
            await auth.UsernamePasswordAsync(consumerkey, consumersecret, username, password);

            var instanceUrl = auth.InstanceUrl;
            var accessToken = auth.AccessToken;
            var apiVersion = auth.ApiVersion;

            var client = new ForceClient(instanceUrl, accessToken, apiVersion);



            //Toolkit handles all serialization
            var contacts = await client.QueryAsync<Contact>("SELECT Id, LastName From Contact");

            //loop through returned contacts
            foreach (Contact c in contacts.Records)
            {
                Console.WriteLine("Contact - " + c.LastName);
            }
I get following exception 'A first chance exception of type 'Salesforce.Common.ForceException' occurred in mscorlib.dll' while trying to get contact details.
I have added two entries in contacts which can be seen from UI.
Any guesses what can be the reason for issue?

Thanks in advance.

I'm new to SFDC Development and Cloud Development in general. Could someone please point me to a simple example of a vs2010 c# console app that authenticates to my SFDC Developer account, then uses the Force.com REST API to query some data from one of my custom objects. I'm not a JAVA guy. Finding this type of an example has been difficult. I've created both a User Token and a Remote Access entry in my SFDC developer account. What do I need to install on my machine to be able to access SFDC from vs2010 projects. In one of the c# examples i've found, the project had a WEB REFERENCE to apex and apex metadata. Under the .NET 4 Framework, I don't even have an option to add a WEB REFERENCE. I noticed if I change my project settings to .NET 2.0, I do have the option of adding a WEB REFERENCE. So, in VS2010, C#, how do I get what I need for developement/connectivity to salesforce. Thanks!

  • September 07, 2012
  • Like
  • 0