puneet's profileAchilles WatchesPhotosBlogListsMore ![]() | Help |
MOSS 2007 - Create a survey, add question and choices programmaticallyI was trying to create an out of the box survey programmatically and wanted to add the question and choices to it too. Below is the sample implementation in C#.
SPWeb web = SPControl.GetContextWeb(HttpContext.Current);
// create the out of the box survey using the list template
Guid surveyId = web.Lists.Add("Name of the Title", "Description of the survey", SPListTemplateType.Survey);
SPList survey = web.Lists[surveyId];
string Question = "what?";
StringCollection choices = new StringCollection();
choices.Add("choice1");
choices.Add("choice2");
choices.Add("choice3");
// Set the question and choices for the survey
survey.Fields.Add(Question, SPFieldType.Choice, true, false, choices); // save the changes back to the list
survey.Update();
// save the changes made in the site
web.Update(); Enjai Maadi,
Puneet.H A fast one on new hiresWe just pulled a fast one on the new hires the other day. We welcomed them with pomp and grandeur. We had elephants, drums et all. The video can be seen at http://www.youtube.com/watch?v=9GpPcMVbmtw. You can also watch the video below...
-Enjai Maadi,
Puneet.H
Chart Web part in MOSSFound this link which lets you download a chart web part. You can use it as a bar chart or as a pie chart.
Check it out at ListCharts - new web part.
Enjai Maadi,
Puneet.H |
|
|