locked
How to parse LiveOperationResult data into a bindable collection RRS feed

  • Question

  • If I request "me/calendars" for example, I want a collection that I can bind to a list control. But a LiveOperationResult appears to contain nested IDictionary<String ,Object> name/value collections. Instead I want a collection of Calendar objects. Is there any shorthand approach to get from the name/value collection to the collection of Calendar objects without looping and manually creating each Calendar instance and individually populating each of its properties? Thanks,   -Doug

    Saturday, November 24, 2012 10:55 PM

Answers

  • The nested objects are actually dynamic types. It should be easy to construct your own object or simply access the object properties using dot operator.

    E.g.

                    dynamic items = result.data;
                    foreach (dynamic item in items)
                    {
                        this.ListBox.Items.Add(item.Name);
                    }

    http://msdn.microsoft.com/en-US/library/live/hh826523#reading

    Thanks,

    Lin


    Tuesday, November 27, 2012 6:32 PM
    Moderator

All replies

  • We do not provide data types for objects received from the server. I could only suggest you creating a wrapper object or copy the fields over to your own data type like you have mentioned.

    Simon

    Tuesday, November 27, 2012 6:12 PM
  • The nested objects are actually dynamic types. It should be easy to construct your own object or simply access the object properties using dot operator.

    E.g.

                    dynamic items = result.data;
                    foreach (dynamic item in items)
                    {
                        this.ListBox.Items.Add(item.Name);
                    }

    http://msdn.microsoft.com/en-US/library/live/hh826523#reading

    Thanks,

    Lin


    Tuesday, November 27, 2012 6:32 PM
    Moderator