Integrating Salesforce with .NET application for Bulk data Load

Share on facebook
Share on twitter
Share on linkedin
This article provides details on the options to integrate the Force.com platform with Microsoft .NET.

This article provides details on the options to integrate the Force.com platform with Microsoft. NET. After reading this article, you will have a foundation of methodologies, best practices, and code samples to leverage the Force.com Toolkit across any Microsoft .NET platform. Microsoft .NET developers can leverage existing toolsets and programming language knowledge to integrate Salesforce with .Net Desktop application or web application rapidly and efficiently.  

This article provides step-by-step instructions to establish such an integration, which involves the following high-level steps: 

Before we begin, there are a set of prerequisites that you need to get done in order to interact with Salesforce using the DeveloperForce Toolkits. NET. 

DeveloperForce Toolkits for .NET 

DeveloperForce.Force NuGet provides a .NET library for interacting with Salesforce Lightning REST APIs. 

The easiest way to get this toolkit is to use the NuGet packages.  

Step 1: .Net Console Application 

Let’s start exploring the DeveloperForce Toolkits for .NET functionality by creating a sample .Net console application. 

Create a new Project and select console Application in Visual Studio 

To add DeveloperForce Toolkits for .NET, open up the NuGet packages dialog and search “DeveloperForce”. 

Step 2: Authenticate using DeveloperForce Toolkit for .NET 

  1. Capture username, password, ClientID, clientsecret, securityToken: These values can be hardcoded as part of your application’s .config files, stored in a database for retrieval, or passed to the API via values collected from the application user.  

Consumer key, Consumer secret, and security token are taken from the Salesforce app and placed in the .Net config to establish the connection. 

In this example, the username and password are simply hardcoded as string variables within the application. 

We have just successfully logged into Salesforce and now we can create ForceClient to perform the Bulk Data Load operations on Salesforce. In this example, we can choose the “Case” object to perform the Bulk Data Load. 

We can consider using the text file entries to create the “Case” in Salesforce. C# code helps to read the file and create the collection list to push it to the Salesforce. The below code illustrates the operation. 

Create a text file named “casefile.txt” and map the location to read the content for the case creation. Refer to the CaseModel C# object to add the content accordingly in the file. 

Step 3: Upload bulk Case to the Salesforce platform 

The below code illustrates the Bulk case creation in the Salesforce from the text file. 

Reference: 

https://developer.salesforce.com/wiki/integrating_force-com_with_microsoft_-net

http://www.ashishblog.com/integrating-salesforce-using-the-developerforce-toolkit-for-net 

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.