SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a sharepoint survey with VS2012.

I managed to create the survey with several question and here is some sample:

            SPWeb web = properties.GetWeb();
            Guid id = web.Lists.Add("survey", "desc", SPListTemplateType.Survey);
            SPList list = web.Lists[id];

            string Question1 = "choose from option";
            StringCollection collection1 = new StringCollection();
            collection1.Add("opt 1");
            collection1.Add("opt 2");
            collection1.Add("opt 3");
            list.Fields.Add(Question1, SPFieldType.Choice, true, false, collection1);

My question how can I add a question with type Rating Scale ?

I can't find any sample of doing this, maybe need to use (SPFieldRatingScale) but can't understand how.

Hope for any help or directions TIA

share|improve this question

I managed to do it like that:

string Question3 = "from scale 1 - 5."; StringCollection collection3 = new StringCollection();

            list.Fields.Add(Question3, SPFieldType.GridChoice, true, false, collection3);
            SPFieldRatingScale srs = list.Fields[Question3] as SPFieldRatingScale;
            srs.Choices.Add("some text");
            srs.Choices.Add("another text");
            srs.GridTextRangeLow = "low";
            srs.GridTextRangeHigh = "high";
            srs.GridTextRangeAverage = "avg";
            srs.GridStartNumber = 1;
            srs.GridEndNumber = 5;
            srs.GridNAOptionText = "Not relevant";

and than add it to the survey list

share|improve this answer

I never do that but in the MSDN there is a guide How to: Create a Custom Field Value Class that could help you:

share|improve this answer
I managed to do it like that: – Ronen Apr 9 '13 at 10:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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