Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JShare
>
Tutorial
> Copy file
The following example shows you how to copy and move (rename) files.
import com.independentsoft.share.Service; import com.independentsoft.share.ServiceException; public class Example { public static void main(String[] args) { try { Service service = new Service("https://independentsoft.sharepoint.com", "username", "password"); boolean copySuccess = service.copyFile("/Shared Documents/Test.docx", "/Shared Documents/MyTestFolder/Test.docx"); System.out.println("Copy success = " + copySuccess); boolean moveSuccess = service.moveFile("/Shared Documents/Test.docx", "/Shared Documents/NewFileName.docx"); System.out.println("Move/Rename success = " + moveSuccess); } catch (ServiceException ex) { System.out.println("Error: " + ex.getMessage()); System.out.println("Error: " + ex.getErrorCode()); System.out.println("Error: " + ex.getErrorString()); System.out.println("Error: " + ex.getRequestUrl()); ex.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*