Skip to content

Getting the value of a List property #107

Answered by KoditkarVedant
KevinDaGame asked this question in Q&A
Discussion options

You must be logged in to vote

@KevinDaGame I see what you are doing wrong. The problem you are getting is that the Console.WriteLine is printing the Type of the data instead of the value that is because Console.WriteLine try to convert the value of any type into string but there is no overload of ToString() method defined for the custom type Notion.Client.TitlePropertyValue (or for any PropertyValue type).

You need to write some method to extract the value out.

example.

foreach(Page p in list) {
       var val = GetValue(p.Properties["Taak"])
       Console.WriteLine(val);
}


object GetValue(PropertyValue p)
{
    switch (p)
    {
        case RichTextPropertyValue richTextPropertyValue:
            return richTextPr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KevinDaGame
Comment options

Answer selected by KevinDaGame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants