3

I am able to get all the fields in a survey using the web api url :

_api/Web/Lists(guid'cecxc8b4-bbvc-472c-ae3f-d648bd0bb025')/Fields

How ever I am not able to distinguish questions from the fields. It is returning all the fields (internal, hidden etc.).

Is there a way to get the questions only? Will an Odata filter work?

I need to render these questions in client side using angularJS.

2 Answers 2

3

You could also filter fields by SPField.CanBeDeleted property in order to get the list of questions from a Survey List

How to get the list of questions from a Survey List via REST API

/_api/Web/Lists/getByTitle('Survey')/fields?$filter=(CanBeDeleted eq true)
0

I found out a method. This might not be the optimised one.

We can use Odata filter to get only the questions of a survey.

_api/Web/Lists(guid'cecxc8b4-bbvc-472c-ae3f-d648bd0bb025')/Fields?$filter=(Hidden eq false) and (ReadOnlyField eq false) and (FromBaseType eq false)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.