Skip to content

Instantly share code, notes, and snippets.

@steefjan
Created August 11, 2010 12:30
Show Gist options
  • Save steefjan/518903 to your computer and use it in GitHub Desktop.
Save steefjan/518903 to your computer and use it in GitHub Desktop.
/// <summary>
/// Eventhandler for GetDetails button click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnGetDetails_Click(object sender, EventArgs e)
{
//Initialize textbox
txtAccountDetails.Text = "";
//Create instance proxy to service
CRMContactService svc = new CRMContactService();
//Instantiate SessionHeader Object
SalesForce.Integration.POC.TestApp.SFSvcAccountRef.SessionHeader sessionHeader = new SalesForce.Integration.POC.TestApp.SFSvcAccountRef.SessionHeader();
//Create an instance of SalesForce Account object
SalesForce.Integration.POC.TestApp.SFSvcAccountRef.Account account = new SalesForce.Integration.POC.TestApp.SFSvcAccountRef.Account();
try
{
//Retrieve Session ID
sessionHeader.sessionId = ForceToken.SessionId;
//Assign SessionId to Header
svc.SessionHeaderValue = sessionHeader;
//Call Service
account = svc.GetAccountByName(txtAccountName.Text);
//Report results back to textbox
txtAccountDetails.Text = account.Website;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment