Forum Discussion

Joe Fischer's avatar
Joe Fischer
Copper Contributor
Jul 17, 2018
Solved

copy an mhtml document from a local share to a SharePoint Online document library on a schedule

Hi All,

I have a reporting services report that places an mhtml file on a local share.  I would like to display this on the home page of one of my sites using a web part. 

Is there a way for me to copy that file from the local share to SPO document library?

 

I tried to create a batch file, but it keeps complaining

move  /y   \\<blah>\shared\Common\<me>\SSRSSnapshots\Inventory.mhtml "https://<domain>.sharepoint.com/<Site>/DocsImages"
The filename, directory name, or volume label syntax is incorrect.

 

I changed the destination to another local drive and it worked fine, so its not the command (maybe)

 

Does anyone know how to do this?  My company is trying to move everything to the cloud and it is really giving more grief than expected. 

 

Thanks in Advance,

Joe

 

  • Joe...you're best option would be to use PowerShell and add the file to the library.  Here is a script that will help.

5 Replies

  • Joe...you're best option would be to use PowerShell and add the file to the library.  Here is a script that will help.

    • Joe Fischer's avatar
      Joe Fischer
      Copper Contributor

      Thanks Steve,

      This looks too easy :)

      Is there a way to automate that? 

      It looks like it will prompt for a password.

       

      Thanks Again,

      joe

      • spucelik's avatar
        spucelik
        Icon for Microsoft rankMicrosoft

        Joe...use this variable to "hard" code the password to avoid the prompt:

        $Password = ConvertTo-SecureString –String "<PASSWORD>" –AsPlainText -Force

         

        You can also use the task scheduler to run the script.  here are the actions you should use when configuring the task.

         

        Program/Script:  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

         

        Add Arguments:  -psconsolefile "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\psconsole.psc1" -command "[FullPathToScript]"

Resources