0

コンソールアプリを介してサイトにリストを追加しようとしています。これが私がこれまでに持っているものです。

namespace spConsole
{
class Program
{
    static void Main(string[] args)
    {
        using (SPSite site = new SPSite("http://spdev.com/SitePages/Home.aspx"))
        {
            SPWebCollection webcoll = site.AllWebs;

            SPWeb web = webcoll["SubSite1"];

            SPList newList = web.Lists.Add("New List", "Description", SPListTemplateType.GenericList);                             

        }
    }
}
}

次のエラーが発生します:タイプ「System.Guid」を「Microsoft.SharePoint.SPList」に暗黙的に変換できません

誰かが私が間違っていることを教えてもらえますか?

4

1 に答える 1

0

SPSite のインスタンスを作成していません

プログラムで新しいリストを作成するには、このリンクに従ってください

http://sarangasl.blogspot.com/2009/11/create-sharepoint-list-programmatically.html

また

http://www.mindfiresolutions.com/Create-List-Programmatically-in-SharePoint-274.php

于 2013-01-28T07:27:30.153 に答える