Sharepoint survey: How to identify the question fields when fetching survey information from the Lis
Posted
by paul
on Stack Overflow
See other posts from Stack Overflow
or by paul
Published on 2010-03-16T09:11:18Z
Indexed on
2010/03/16
9:16 UTC
Read the original article
Hit count: 467
I am wanting to access survey information via the Lists web service and display the questions contained in the survey.
The result contains a large number of Field nodes some of which are the questions in the survey. The other fields contain other information such as author, last changed etc.
How can I pick out the questions? I had thought that all non-questions would be hidden but this is not the case.
Here is my code as it is at the moment. It returns about 16 items. The survey has 6 questions...
// read question definitions
string[] HandleTypes = new string[] { "Number", "DateTime", "Text", "Choice", "GridChoice", "Boolean" };
var query = from n in node.Descendants(ns+"Field")
where (n.Attribute("Hidden") == null || n.Attribute("Hidden").Value.ToLower() == "true")
&& (n.Attribute("Type") != null && HandleTypes.Contains(n.Attribute("Type").Value))
select new Question(n.Attribute("ID").Value)
{
Text = n.Attribute("DisplayName").Value,
QuestionType = n.Attribute("Type").Value,
Element = n
};
Ideas anyone?
© Stack Overflow or respective owner