Code Monkey home page Code Monkey logo

Comments (5)

franknesse avatar franknesse commented on July 28, 2024 1

ok, clear. Thanks for the feedback. I will close this one.

from hubspot.net.

Psypher9 avatar Psypher9 commented on July 28, 2024

Hi @franknesse, thanks for your issue. Could you please tell me which version of the package you are using and perhaps post a little more of the code you are using around this for each loop?

from hubspot.net.

franknesse avatar franknesse commented on July 28, 2024

Hello @Psypher9 , thanks for your quick reply. I am using version 0.6.17 (just installed it from NuGet).
The code is nothng more than:

var api = new HubSpotApi("<my api key>");			
var result = api.Contact.List<HubSpot.NET.Api.Contact.Dto.ContactHubSpotModel>();			
foreach (ContactHubSpotModel contact in result.Contacts)
{
	Console.WriteLine($"{contact.FirstName} {contact.LastName} {contact.Email}");
}

And the output is:
image

And this is my hubspot application:
image

from hubspot.net.

franknesse avatar franknesse commented on July 28, 2024

I managed to get the e-mail address now, by providing a ListRequestOptins object as follows:

var api = new HubSpotApi("<my api key>");
ListRequestOptions options = new ListRequestOptions()
{
	PropertiesToInclude = new List<string> { "firstname", "lastname", "email" }
};
var result = api.Contact.List<HubSpot.NET.Api.Contact.Dto.ContactHubSpotModel>(options);
foreach (ContactHubSpotModel contact in result.Contacts)
{
	Console.WriteLine($"{contact.FirstName} {contact.LastName} {contact.Email}");				
}

But for me it is not clear yet why last and first name are provided by default where as I need to explicitly request for the email using the ListRequestOptions object. Can anybody explain this behavior to me?

from hubspot.net.

Psypher9 avatar Psypher9 commented on July 28, 2024

@franknesse, this is actually due to HubSpot's API specifications found here under the Optional Parameter section and Property. Their API only includes a few properties (i.e. first and last name) by default when getting all contacts by this method.

from hubspot.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.