How to programmatically view a document from a remote sharepoint server (C #)

I did quite a bit of research on how I could do this, but could not find a solution ... My use case is the following: there are some excel sheets in our corporate intranet (SharePoint); my software should check them, open, edit and check again (from the client machine). I can access the files through the unc path (\ server \ whatever.xls). Now I can copy them to the local machine, do the editing, save them, but since they were not extracted, I can not download them again.

Is there any way to do this?

How do I do this, SPFile.CheckOut should do the trick, but I did not find any information on how to find the Microsoft.SharePoint.dll file ...

Thanks in advance, Adam

+4
source share
1 answer

I assume that you are using your code on a computer where SharePoint is not hosted. And you want to remotely check file (s). In this case, use the SharePoint ListService form for this.

Here is a small example:

Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists(); listService.Credentials = System.Net.CredentialCache.DefaultCredentials; string fileCheckout = "http://Server_Name/sites/Subsite/Shared Documents/MyFile.txt"; bool myResults = listService.CheckOutFile(fileCheckout, "true", "20 Jun 2006 12:00:00 GMT"); 

Here you can see all the SharePoint services:

http://msdn.microsoft.com/en-us/library/dd878586%28v=office.12%29.aspx

If you use the code on the computer where SharePoint is installed, in this case you can add a link to Microsoft.SharePoint.dll and continue. If you want to deploy your code on a machine that will also host the SharePoint server, you need to compile the code in a similar environment.

0
source

Source: https://habr.com/ru/post/1379441/


All Articles