Copy files from Azure File Shares to a specific OneDrive or SharePoint location with Java

363 Views Asked by At

I have a scenario which we use a Azure File Share storage to store large files and need to copy those files to another location such as OneDrive or Share Point. Copying files will be selected based on some criteria and I need to start this in a Spring Boot application with a scheduled task.

Is this task feasible with Java and other above mentioned Microsoft Products?

1

There are 1 best solutions below

0
On BEST ANSWER
  • Here is the Sample code where you can create an Azure file share using Java Application.
public static Boolean createFileShare(String connectStr, String shareName)
{
    try
    {
        ShareClient shareClient = new ShareClientBuilder()
            .connectionString(connectStr).shareName(shareName)
            .buildClient();

        shareClient.create();
        return true;
    }
    catch (Exception e)
    {
        System.out.println("createFileShare exception: " + e.getMessage());
        return false;
    }
}