Quantcast
Channel: Discussion Forum > Connect Data Services
Viewing all articles
Browse latest Browse all 2504

Unable to get contacts by email address via the API (2 Comments)

$
0
0

Topic by Bryan Scarborough

Hello, 

I am trying to retrieve a contact's id number based on the contact's email address.  In our system, we allow multiple contacts with the same email which is what i thought was causing my error at first, since I was searching for an email that is on multiple contacts, but I changed to an email that is only on 1, and I still get the same error.

 

The error is 

Invalid ID: Multiple Contact records with LookupName = ''

 

I am writing the code in C# and we are running Nov 2012 version.

 

Here is my code

        Contact contact = new Contact();
 
        ID contactID = new ID();
        contactID.idSpecified = false;
        contact.ID = contactID;
 
        Email[] searchEmail = new Email[1];
        Email contactemail = new Email();
        contactemail.Address = emailstring;
        contactemail.actionSpecified = false;
        searchEmail[0] = contactemail;
        
        contact.Emails = searchEmail;
 
        RNObject[] objects = new RNObject[] { contact };
        GetProcessingOptions options = new GetProcessingOptions();
        options.FetchAllNames = false;
 
        try
        {
            ClientInfoHeader clientInfoHeader = new ClientInfoHeader();
            clientInfoHeader.AppID = "Basic Get";
 
            RNObject[] rnObjects = _service.Get(clientInfoHeader, objects, options);
 
            contact = (Contact)rnObjects[0];
 
            return contact.ID;
        }
 

Thanks, I'm sure its something simple I am missing.


Viewing all articles
Browse latest Browse all 2504

Trending Articles