GetPredefinedList
Description
Get a single Predefined List
Signature
SurveySchema GetPredefinedList(string key, string projectId, string name, ReadFilterSimple readFilterSimple)
Parameters
Name | Data Type | Description |
---|---|---|
key |
string required |
The authentication key |
projectId |
string required |
ID of the project |
name |
string required |
Name of the Predefined List |
readFilterSimple |
ReadFilterSimple required |
Filter used to specify the target |
Example
// Create instance of the webservice
var authoring = new AuthoringSoapClient();
//***************************************************
//
// Retrieve, change and update PredefinedList
//
//***************************************************
// Create a ReadFilterSimple
// Retrieve all languages
// Set references to other PredefinedLists as reference and not expanded
// Enable update
ReadFilterSimple readFilterSimple = AuthoringUtil.NewReadFilterSimple(true,false,true);
// Get the predefined list named "a-g"
SurveySchema def = authoring.GetPredefinedList(key,projectID,"a-g",readFilterSimple);
// Check that we got a reply
if (def.Root.Nodes.Length == 0)
throwError();
// Get the predefined list
PredefinedList predefinedList =
(PredefinedList)def.Root.Nodes.GetValue(0);
// Make changes
// Add a new Answer
Answer newAnswer = AuthoringUtil.NewAnswer("BMW");
// Give values to the new answer
AnswerText answerText =
AuthoringUtil.NewAnswerText("BMW",9);
ArrayList texts = new ArrayList();
texts.Add(answerText);
newAnswer.Texts = (AnswerText[])texts.ToArray(typeof(AnswerText));
// Add new answer to answerlist
ArrayList answers = new ArrayList((Array)predefinedList.Answers);
answers.Add(newAnswer);
predefinedList.Answers = (AnswerBase[])answers.ToArray(typeof(AnswerBase));
// Update
authoring.Update(key,projectID,def);