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

2 Answers 2


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


I never do that but in the MSDN there is a guide How to: Create a Custom Field Value Class that could help you: http://msdn.microsoft.com/en-gb/library/ms480788.aspx

  • I managed to do it like that:
    – Ronen
    Commented Apr 9, 2013 at 10:07

Your Answer

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

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