I am writing a program which reads data from CSV text files and attempts to upload data into my organization's Salesforce account. I am writing this console application in C# and with my organization's Enterprise WSDL.
I am attempting to insert data from a different CSV file to a standard Salesforce object called "Leads". One field in the CSV file I am reading is called "Assigned to Rep Name" and it corresponds to a custom field in the Leads object called "Assigned_to_Rep_Name__c" which is of type "string" (according to the WSDL, but it is actually a Picklist with Controlling Field being "Department Name" when I open it in Salesforce.)
While I have been successful in upserting this object with mostly correct data, it is apparent that the names of these representatives are already in my organization's instance of Salesforce. Therefore, by me assigning this field to what I have in the CSV, it is inserting duplicate data. I want to assign the field to an already existing vale, since the allowable picklist values have already been hard coded into Salesforce by a previous admin.
How do I programmatically select the correct Picklist value in my code before I upsert the Lead record into Salesforce?