简体   繁体   中英

How can I programatically download a file from a sharepoint server and lock it?

I would like to download a file from a sharepoint server using C#, check it out, and put a lock on it so no other user can modify that file. After changing the file, I want to check it in again with a comment, and of course remove the lock.

Which is the best way to do it? I read about the SPSite class already, but this seems to be part of the Sharepoint Services which are only available for server operating systems. However, I need to do that from a client running Windows 7.

Any hints how this can be achieved?

Add a Web Reference to the Lists web service, located on your SharePoint server; eg http://yourserver/_vti_bin/Lists.asmx to your project.

This web service exposes some basic operations, including the ability to check documents in and out. Checking out a document implicitly locks it from editing by other users. You can download a local copy of the document using the DownloadFile method of the WebClient class. When checking the document back in, the web service allows you to add a comment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM