0

I want to check documents properties in SharePoint library. Please tell me how to open SharePoint website in windows service. I am using following code in windows service, it gives "site not found error".

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

Detail Error is,

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
st4hoo
  • 2,196
  • 17
  • 25
Sachin RK
  • 21
  • 2
  • 9

1 Answers1

1

Your code is fine.

Are you sure that http://xyz/sites/abc is a site? Is the URL correct?

If the URL is correct then check if you have required permissions to open it.

EDIT:

Check this thread also: SharePoint error: Web application at xxxx could not be found

Community
  • 1
  • 1
st4hoo
  • 2,196
  • 17
  • 25