I'm trying to upload files to sharepoint, in a desktop C# application. The script is being used to deploy .jar modules to the company sharepoint page.

When I try to use this code:

SPWeb web = new SPSite(sharePointSite).OpenWeb();

I get the error:

Could not load file or assembly 'Microsoft.SharePoint.Library, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

It's the exact same problem as this person here: https://stackoverflow.com/questions/45410221/could-not-load-file-or-assembly-microsoft-sharepoint-library-which-ive-never

They installed the components, like I did, and still weren't able to run the application.

Their final update was:

Finally resolved the issue. There was a SharePoint.dll in the bin folder of the project that once deleted, the project was able to run as normal.

which really does not help.....

I've read about there being a client and object model, and there being different DLL's for each.

But, I'm very confused, and can't find appropriate docs.

  • The object modal that you are trying to use is part of SharePoint dll that is available only inside SharePoint Server where they are installed. To run it you would need a SharePoint enviornment . Try SharePoint Client dll as alternate. – Arvi May 9 '18 at 1:50

If you are running this code on a server running SharePoint you would likely need the server-side assemblies. If you are running it on a machine that doesn't have SharePoint Server and you are connecting over the network you will need the client-side assemblies.

Based on what you are trying to do -- i.e. upload a file from a desktop machine -- you probably need the client assemblies.

Here are the current bits for the versions of SharePoint that are currently supported:

SharePoint Server 2016 Client Components SDK

SharePoint Server 2013 Client Components SDK

And if you are connecting to SharePoint Online:

SharePoint Online Client Components SDK

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.