What happened? Next steps Getting started Customizing ReadMe Feedback

Developing with Salesforce

Here is how your project has been updated to use Salesforce

References have been added to your project

NuGet package references

*This NuGet package provides a .NET library for interacting with Salesforce's Force.com core REST APIs.

.NET references

* added if you've chosen to Scaffold the Salesforce Objects

A configured connection class was added to the Service folder

A configured service class, SalesforceService.cs and SalesforceOAuthRedirectHandler.cs (for web server flow only) were added to the Service References\Salesforce folder. This class will provide a configured connection, reading values from app/web.config, providing a ForceClient to execute Salesforce REST requests.

With the values being read from app/web.config, you can manage the configurations as they change through your deployment environments.

Your app/web.config has new configuration values

Depending on the project type and the authentication strategies you've chosen, some of the following entries have been added.

<appSettings>
<!-- The Salesforce connected app is named: YourProjectName-Dev -->
<add key="Salesforce:ConsumerKey" value="yourKey" />
<add key="Salesforce:ConsumerSecret" value="yourSecret" />
<add key="Salesforce:RedirectUri" value="/SalesforceOAuthRedirectHandler.axd" />
<add key="Salesforce:Domain" value="https://login.salesforce.com" />
</appSettings>
<appSettings>
<!-- The Salesforce connected app is named: YourProjectName-Dev -->
<add key="Salesforce:ConsumerKey" value="yourKey" />
<add key="Salesforce:ConsumerSecret" value="yourSecret" />
<add key="Salesforce:Username" value="yourUsername" />
<add key="Salesforce:Password" value="yourPassword" />
<add key="Salesforce:SecurityToken" value="yourSecurityToken" />
<add key="Salesforce:Domain" value="https://login.salesforce.com" />
</appSettings>

*For more information about Security Tokens, visit Resetting Your Security Token

A Connected App was created in Salesforce Setup

Based on the authentication strategy you've chosen, a Connected App was configured enabling your application to be authenticated against the Salesforce REST APIs. A Consumer Key and Consumer Secret have been created for your Connected App and saved to app/web.config. You may change the Connected App in Salesforce Setup.

*Note: if you change your Consumer Secret you will need to update the app/web.config file to reflect the new values.

To find the name, open app/web.config, and look for the following line:

<appSettings>
    <!-- The Salesforce connected app is named: YourProjectName-Dev -->
</appSettings>
Deployment Tip

When you're ready to deploy your application to another environment, you'll need to edit or create another Connected App with the appropriate settings, particularly the callback url, and update the app/web.config file to the target environment.

If you're using the same Connected App across two different development instances, be sure to verify the :port number as well. Remember that it may take several minutes for Salesforce to propagate your changes, so give it a bit, or verify the redirects are proper before questioning your code.