在Windows服务中打开spweb

时间:2014-06-03 11:39:13

标签: c# sharepoint-2010

我想检查SharePoint库中的文档属性。请告诉我如何在Windows服务中打开SharePoint网站。 我在Windows服务中使用以下代码,它提供"网站未找到错误"。

SPSite spSite = new SPSite("http://xyz/sites/abc");

详细错误是,

System.IO.FileNotFoundException: The Web application at http://xyz/sites/abc could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
   at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
   at SSP_DL_notify_service.Service1.GetMail(Object sender, ElapsedEventArgs args) in C:\Users\pqr\Documents\Visual Studio 2010\Projects\SSP_DL_notify_service\SSP_DL_notify_service\Service1.cs:line 54

1 个答案:

答案 0 :(得分:1)

你的代码很好。

您确定http://xyz/sites/abc是某个网站吗?网址是否正确?

如果网址正确,请检查您是否具有打开它所需的权限。

修改

同时检查此主题:SharePoint error: Web application at xxxx could not be found