Вопрос

I am developing a windows service in C# and adding dll for SharePoint.

I have added reference from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll

The exception is thrown when I do:

using (SPSite objSPSite = new SPSite(_spURL))
 {

The url is correct because if I try in powershell, I can connect to it

$web = Get-SPWeb(_spURL)
Это было полезно?

Решение

Please check the Framework version of your project as Sharepoint 2010 is supported for .Net 3.5 A program does need to target the framework 3.5 to use the SharePoint 2010 object model, according to the exception

Also check the following link:

http://social.technet.microsoft.com/Forums/en-US/3b31ad0b-6f0c-4a68-abda-3fb086d070fe/microsoft-sharepoint-is-not-supported-with-version-40303191-of-the-microsoft-net-runtime?forum=sharepointdevelopmentprevious

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top