protected void btnGetMultipleLeadsLeadList_Click(object sender, EventArgs e) { Marketo_WS_2_0.ResultGetMultipleLeads resultReqGetMultipleLeads = new Marketo_WS_2_0.ResultGetMultipleLeads(); string result = GetMultipleLeadsByListID(txtGetMultipleLeadsLeadsList.Text, ref resultReqGetMultipleLeads); lblResultGMLListID.Text = result; lblResultGMLListIDData.Text = "Found " + resultReqGetMultipleLeads.returnCount + " leads."; }
private string GetMultipleLeadsByListID(string in_list, ref Marketo_WS_2_0.ResultGetMultipleLeads rs) { Marketo_WS_2_0.SuccessGetMultipleLeads response = new Marketo_WS_2_0.SuccessGetMultipleLeads(); string results = ""; string userID = txtUserID.Text; string EncryptionKey = txtEncryptionID.Text; string requestTimeStamp = ConvertDateToW3CTime(DateTime.Now); string stringToEncrypt = requestTimeStamp + userID; string message; string key; key = EncryptionKey; message = stringToEncrypt; System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] keyByte = encoding.GetBytes(key); HMACSHA1 hmacsha1 = new HMACSHA1(keyByte); byte[] messageBytes = encoding.GetBytes(message); byte[] hashmessage = hmacsha1.ComputeHash(messageBytes); string header = ByteToString(hashmessage); Marketo_WS_2_0.MktowsContextHeaderInfo ws_context = new Marketo_WS_2_0.MktowsContextHeaderInfo(); ws_context = null; Marketo_WS_2_0.AuthenticationHeaderInfo ws_header = new Marketo_WS_2_0.AuthenticationHeaderInfo(); ws_header.mktowsUserId = userID; ws_header.requestSignature = header.ToLower(); ws_header.requestTimestamp = requestTimeStamp; Marketo_WS_2_0.ParamsGetMultipleLeads ws_leads = new Marketo_WS_2_0.ParamsGetMultipleLeads(); Marketo_WS_2_0.LeadKeySelector lks = new Marketo_WS_2_0.LeadKeySelector(); lks.keyType = Marketo_WS_2_0.LeadKeyRef.IDNUM; lks.keyValues = in_list.Split(','); ws_leads.leadSelector = lks; ws_leads.batchSize = 10; ws_leads.batchSizeSpecified = true; try { response = client.getMultipleLeads(ws_header, ws_leads); results = ""; rs = response.result; } catch (Exception e) { results = e.Message; rs = null; } return(results); }