0

From this answer I have known how to upload/download a file to a sharepoint file. I have added the nuget package with

Install-Package Microsoft.SharePointOnline.CSOM -Version 16.1.20616.12000

with

using Microsoft.SharePoint.Client;

The problem is that I don't know how to reference SPSite and SPFile because I can't find it in any namespace.

enter image description here

The

Thanks

Clemens
  • 123,504
  • 12
  • 155
  • 268
Luca
  • 918
  • 2
  • 13
  • 30
  • @Clemens so is it not relevant WPF? I have seen differences in that context between WPF and WF but I am new to sharepoint and I might be wrong. – Luca Feb 15 '22 at 11:04
  • 1
    The question does not seem to have anything to do with WPF. – Clemens Feb 15 '22 at 11:11
  • SPSite is not a part of Microsoft.SharePointOnline.CSOM. It's from C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.SharePoint.dll as mentioned in the comment under accepted answer. – user2250152 Feb 15 '22 at 11:25
  • Thanks. But I had disregarded that because under C:\Program Files\Common Files\microsoft shared I have no "Web server extension" folder – Luca Feb 15 '22 at 11:30

1 Answers1

1

You can directly install the nuget package with

Install-Package Microsoft.SharePoint.dll

info is here

Patrick
  • 3,073
  • 2
  • 22
  • 60
  • It works thanks. But I still have an error on the var type Folder. – Luca Feb 15 '22 at 12:57
  • 1
    It is SPFolder not folder! – Patrick Feb 15 '22 at 13:00
  • 1
    I believe that for WPF it better is following this example https://social.msdn.microsoft.com/Forums/en-US/4baa9152-8e11-410f-934a-78d9119f970f/c-wpf-how-to-download-and-upload-file-from-sharepoint-teamsite-document-library?forum=sharepointdevelopment – Patrick Feb 16 '22 at 08:09
  • 1
    Otherwise you will have problems in linking and embedding the dlls. – Patrick Feb 16 '22 at 08:09