Quantcast
Channel: Active questions tagged atom-feed+odata+c# - Stack Overflow
Viewing all articles
Browse latest Browse all 2

SharePoint List- OData - Is it possible to acces the Choices in a Choice column?

$
0
0

I'm in the process of writing a dynamic OData client that connects to a SharePoint 2010 server.

I would really like to be able to access a List and all it's related columns. If it's a choice column I would like to be able to access the possible choices that have been defined. Is this even possible?

I've been trying to find the information I want by feeding the /listdata.svc/$metadata into an IEdmModel. I just can't figure out where it might be though.

Here's what I've started with, I can loop through entities in the model, and through their respective properties. I can see that the Choice column's show up as type Entity.

Example: I have a column named AQUISITION_TYPE, with "Donation","Purchase","Tax Sale" as possible choices.

Assuming this isn't a dead end, any pointers would be appreciated.

foreach ( IEdmEntityType type in model.SchemaElementsAcrossModels().OfType<IEdmEntityType>())
        {
            str_test += "\n" + type.FullName();

            foreach (IEdmProperty property in type.Properties())
            {
                //my Choice columns are of type Entity
                if (property.Type.IsEntity())
                {
                    str_test += "\t" + property.Name + " - " + property.Type.TypeKind().ToString() + " - " + property.PropertyKind.ToString() + "\n";

                }
                //My primative column types are here
                else
                {
                    str_test += "\t" + property.Name + " - " + property.Type.TypeKind().ToString() + " - " + property.PropertyKind.ToString() + "\n";
                }
            }

        }

Partial Solution... I can find the information I want very easily within the lists.asmx SOAP service.


Viewing all articles
Browse latest Browse all 2

Trending Articles