当前位置: 代码迷 >> SharePoint >> 用VS打开sharepoint列表时报错未找到Microsoft.SharePoint.Library.解决办法
  详细解决方案

用VS打开sharepoint列表时报错未找到Microsoft.SharePoint.Library.解决办法

热度:156   发布时间:2016-05-02 07:00:12.0
用VS打开sharepoint列表时报错未找到Microsoft.SharePoint.Library.....


protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                using (SPSite site = new SPSite("http://oa-sp-test:8080"))
                { 
                    using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())
                    {
                        Response.Write(web.Title);
                    }
                }
            }
        }执行以上代码时会报如图所示的错误,求大神解答!!!
------解决思路----------------------
不太理解楼主要做什么。楼主这个是独立的网站吗? 还是开发的SharePoint Solution?

如果是SharePoint Solution,通常情况下,不要在网页程序里new site。也不需要关心dll的引用,因为VS会处理好。如果楼主要获取当前site,要使用
SPWeb oWeb = SPContext.Current.Web;
SPSite oSite = SPContext.Current.Site;

如果楼主是独立的网站,那么要保证
(1)你的网站和SharePoint在同一个server上。
(2)你的网站的application pool user对SharePoint有足够的权限。
(3)你的SharePoint网站运行在64位模式。也就是,IIS要运行在64位模式,因为SharePoint只支持64位。
  相关解决方案