Sharepoint 2010 将项目添加到Sharepoint调查列表

Sharepoint 2010 将项目添加到Sharepoint调查列表,sharepoint-2010,Sharepoint 2010,我在sharepoint中有一个调查列表,我想使用c#code为调查添加一个答案,我认为这可能会被解释为向列表中添加一个项目,所以我尝试了下一个,但没有成功 如何做到这一点 using (SPSite site = new SPSite("http://user-pc")) { using (SPWeb web = site.RootWeb) { try { SPList olist = web.Lists["JobSche

我在sharepoint中有一个调查列表,我想使用c#code为调查添加一个答案,我认为这可能会被解释为向列表中添加一个项目,所以我尝试了下一个,但没有成功

如何做到这一点

using (SPSite site = new SPSite("http://user-pc"))
{
    using (SPWeb web = site.RootWeb)
    {
        try
        {
            SPList olist = web.Lists["JobSchedulle"]; //<- Name of the survey in sharepoint 2010
            SPListItem item = olist.Items.Add();
            item[5] = "good";// <- this survey only has one question, and is a text option ..
            item.Update();

        }
        catch {
            Console.ReadLine();         
        }       
    }
}
使用(SPSite站点=新SPSite(“http://user-pc"))
{
使用(SPWeb=site.RootWeb)
{
尝试
{

SPList olist=web.Lists[“JobSchedulle”];//我发现了错误-代码正常,但我访问的是
项[5]
(索引错误)