• calbright1.3916321021228982E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am using the new Salesforce packages for .Net.  I have sucessfully authenticated with my Salesforce credentials using the following code...

var client = await GetForceClient(httpClient);
var accounts = client.QueryAsync<Account>("SELECT id, name, description FROM Account");
GetContacts(client);

When this posts I see valid access token information in the object. Then problem is that when I try to use the client to get contact information using this code:
private static async Task<object> GetContacts(ForceClient client)
    {
        try
        {
            var contacts = await client.QueryAsync<Contact>("SELECT AccountId,AssistantName,AssistantPhone,Birthdate,CreatedById,CreatedDate,Department,Description,Email,EmailBouncedDate,EmailBouncedReason,Fax,FirstName,HomePhone,Id,IsDeleted,IsEmailBounced,Jigsaw,JigsawContactId,Languages__c,LastActivityDate,LastCURequestDate,LastCUUpdateDate,LastModifiedById,LastModifiedDate,LastName,LastReferencedDate,LastViewedDate,LeadSource,Level__c,MailingCity,MailingCountry,MailingLatitude,MailingLongitude,MailingPostalCode,MailingState,MailingStreet,MasterRecordId,MobilePhone,Name,OtherCity,OtherCountry,OtherLatitude,OtherLongitude,OtherPhone,OtherPostalCode,OtherState,OtherStreet,OwnerId,Phone,ReportsToId,Salutation,SystemModstamp,Title FROM Contact");
            if (contacts == null)
            {
                Console.WriteLine("Failed to retrieve contact by query!");
            }
            Console.WriteLine("Retrieved contacts.");
            return contacts;
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            return null;
        }

    }

An exception is always thrown-- {"A task was canceled."}
Am I missing something? It seems like I should be able to make multiple calls using the same client-- and since I have to have the _accesstoken to make my calls I would seem like this is the only way I can do this.

Thank you for your help.
Chris Albright
I am using the new Salesforce packages for .Net.  I have sucessfully authenticated with my Salesforce credentials using the following code...

var client = await GetForceClient(httpClient);
var accounts = client.QueryAsync<Account>("SELECT id, name, description FROM Account");
GetContacts(client);

When this posts I see valid access token information in the object. Then problem is that when I try to use the client to get contact information using this code:
private static async Task<object> GetContacts(ForceClient client)
    {
        try
        {
            var contacts = await client.QueryAsync<Contact>("SELECT AccountId,AssistantName,AssistantPhone,Birthdate,CreatedById,CreatedDate,Department,Description,Email,EmailBouncedDate,EmailBouncedReason,Fax,FirstName,HomePhone,Id,IsDeleted,IsEmailBounced,Jigsaw,JigsawContactId,Languages__c,LastActivityDate,LastCURequestDate,LastCUUpdateDate,LastModifiedById,LastModifiedDate,LastName,LastReferencedDate,LastViewedDate,LeadSource,Level__c,MailingCity,MailingCountry,MailingLatitude,MailingLongitude,MailingPostalCode,MailingState,MailingStreet,MasterRecordId,MobilePhone,Name,OtherCity,OtherCountry,OtherLatitude,OtherLongitude,OtherPhone,OtherPostalCode,OtherState,OtherStreet,OwnerId,Phone,ReportsToId,Salutation,SystemModstamp,Title FROM Contact");
            if (contacts == null)
            {
                Console.WriteLine("Failed to retrieve contact by query!");
            }
            Console.WriteLine("Retrieved contacts.");
            return contacts;
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            return null;
        }

    }

An exception is always thrown-- {"A task was canceled."}
Am I missing something? It seems like I should be able to make multiple calls using the same client-- and since I have to have the _accesstoken to make my calls I would seem like this is the only way I can do this.

Thank you for your help.
Chris Albright