我编写了一个包含 SPSite 的代码,但出现此错误 CS0246: The type or namespace name 'SPSite' could not be found(您是否缺少 using 指令或程序集引用?)
我已经尝试从这里的 nuget 站点https://www.nuget.org/packages/Microsoft.SharePoint.dll/下载 Microsoft.SharePoint ,然后我将包放在正确的文件夹中,但我仍然有同样的错误
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Security;
using System.Net;
using System.Configuration;
using System.Collections.Specialized;
using System.Runtime;
using Microsoft.SharePoint;
using System.Reflection;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
protected void getList()
{
string strUrl = " SharePoint SITE ";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList list = oWeb.Lists["Workplan"];
foreach (SPField field in list.Fields)
{
Console.WriteLine(field.Title);
}
}
}
}
在正确的位置添加我下载的包后,我预计错误会消失,但它仍然存在。请帮忙!