2
votes

I have a sharepoint list ImageList, i have a column which stores its type

The column name is ImageType

the choices are "profile pic","thumbnail" etc

i want to fetch these choice values for this field

i tried accessing it using

http://myintranet:2010/sites/ImagesGallery/_vti_bin/listdata.svc/ImageList?$expand=ImageType

but it is not containing the choice values in it!

How can i get them?

1

1 Answers

2
votes

The query:

http://myintranet:2010/sites/ImagesGallery/_vti_bin/listdata.svc/ImageList?$expand=ImageType

returns list items values for List resource only.

In order to retrieve field resource itself, the different endpoint have to be specified, in particular:

http://myintranet:2010/sites/ImagesGallery/_vti_bin/listdata.svc/ImageListImageType

It is assumed that list name is ImageList and field name is ImageType

Example

$.getJSON(endpointUrl)
.done(function(data)
{
    //print field choice options
    data.d.results.forEach(function(item){ 
       console.log(item.Value);
    });

})
.fail(function(error){
    console.log(JSON.stringify(error));
});