I'm attempting to use this Simple console example on github as suggested in this answer here. sorry for coming here so much, I just need to make progress.

There is a link of the code that keep throwing an error.

Error CS0029 Cannot implicitly convert type
'Salesforce.Common.Models.SuccessResponse' to 'string'
UserAccounts D:\Salesforce-Research\UserAccounts\View\Program.cs 108

enter image description here

I've compared that line with similar lines in the code:

Console.WriteLine("Creating a parent record (Account)");
dynamic a = new ExpandoObject();
a.Name = "Account from .Net Toolkit";
a.Id = await client.CreateAsync("Account", a);

I've fiddled with the line, trying all different sorts of formats, including parsing the result or parts of it to Account or string (yes I'm desperate). I've checked that it is expecting a string (well it is as Account Id is a string).

I can only assume the code is correct.

  1. Is it correct?
  2. If it is correct what am I supposed to do?



I've decided to go with this:

var account = new Account { Name = "Test Account" };
// account.Id = await client.CreateAsync(Account.SObjectTypeName, account);
var success1 = await client.CreateAsync(Account.SObjectTypeName, account);

if(account.Id == null)
    Console.WriteLine(success1.Errors.ToString() + "Failed to create test record.");


  • what is the result of your last code example? What doesn't work? Oct 15, 2015 at 7:12
  • it gives me an empty [] on the errors, so when I put tostring on the variable, it gives it's type.. Salesforce.commons.models.successresponse
    – user25387
    Oct 15, 2015 at 7:24

1 Answer 1


CreateAsync method returns SuccessResponse. It has three properties: string Id, object Error, and string Success. So, this should work:

var response = await client.CreateAsync("Account", a);
string Id = response.Id;

Your example code worked in the past, but when you take a look at THIS COMMIT, you'll see that - thanks to wadewegner - the return type of CreateAsync is no longer string but the SuccessResponse.

  • This helped me, thank you @Bart . For some other people like me, there are 3 instances in the program.cs file. Need to change them all. Works just well in VS2013. Aug 17, 2016 at 17:25

This site is temporarily in read-only mode and not accepting new answers.