locked
Is there an easier way to transfer files from web server to sharepoint server? RRS feed

  • Question

  • I am trying to transfer some PDF files from our webserver to sharepoint server using powershell script.

    I think I am using referencing correct share in sharepoint.

    Any ideas what I am doing wrong?

    Thanks in advance

    #ftp server 
    $ftp = "https://Delk.sharepoint.com/sites/IT/EntSol/SitePages/Home.aspx?RootFolder=%2Fsites%2FIT%2FEntSol%2FShared%20Documents%2FApplications%2FImaging%5FApplications%2FOnBase%5FKofax%2FSamO&FolderCTID=0x012000D22A3F433B971147ACDB7868A0DAD169&View=%7BA30B9938%2DB1A0%2D48A0%2DA925%2D2A845467612A%7D/Bits/" 
    $user = "user" 
    $pass = "Pass"  
     
    $webclient = New-Object System.Net.WebClient 
     
    $webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)  
     
    #list every PDF file 
    foreach($item in (dir $Dir "*.pdf")){ 
        "Uploading $item..." 
        $uri = New-Object System.Uri($ftp+$item.Name) 
        $webclient.UploadFile($uri, $item.FullName) 
     } 
    

    • Moved by Bill_Stewart Friday, July 7, 2017 6:52 PM This is not SharePoint development forum
    Friday, May 12, 2017 2:39 PM

All replies

  • Not really.  You could use the SharePoint Module.


    \_(ツ)_/

    Friday, May 12, 2017 4:55 PM
  • Powershell by default doesn't include a ftp client module.

    So you can only copy the files over smb (windows share) or http method to file server.

    Sunday, May 28, 2017 6:26 PM