Add files to sharepoint via script

7,820

Solution 1

In the interest of keeping things dead simple, we are going with DavCopy. This lets us run our process, and then run a simple batch script to copy the files to SharePoint. It also produces a nice output report for the copy process.
Syntax: DavCopy.exe * http://www.myserver.com/myFolder

Solution 2

You can directly call the SharePoint APIs through Powershell. Here are some links to help out:

http://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=7 http://wiki.threewill.com/display/enterprise/Add+Files+to+a+SharePoint+Document+Library+using+PowerShell http://pshell.info/sharepoint/166/uploading-documents-to-sharepoint/

Solution 3

Here's an MSDN article describing an ASP.NET approach to this, which you could possibly modify for your situation:

http://msdn.microsoft.com/en-us/library/dd902097.aspx

Solution 4

Not a scripting solution but we have a Delphi Application that needed to do this. Since Document Libraries can be accessed via Explorer as UNC shares we simply just copy the files directly into the Document Library. You can also map a drive to the library if needed.

The Delphi application uses normal Windows File Copy commands to transfer the files.

Solution 5

davcopy works great.. but I had to first set the title column to be an optional field in the upload destination library for it to show up (otherwise it was checked out and folk could not see it) see: http://www.codeproject.com/KB/sharepoint/Removing_Title_column.aspx but set it to optional instead of hidden

Share:
7,820

Related videos on Youtube

Jibba
Author by

Jibba

Updated on September 17, 2022

Comments

  • Jibba
    Jibba almost 2 years

    Looking for a way to automagically add files to a sharepoint document library. We have a process that runs and produces a file (Java process). We would like to either add the file directly to Sharepoint or schedule a task that picks up files and puts them in Sharepoint. So a Java or vb/batch/powershell solution would be the best fit.

  • Jibba
    Jibba almost 15 years
    I was hoping that it would be that simple, but couldn't get a drive mapped or file copy to UNC. Researched and it seems that it works for some and not for others. Probably something in the way the site is setup.
  • Jibba
    Jibba almost 15 years
    Great links - I stumbled upon a simple, free utility that takes care of this for us.
  • RealHowTo
    RealHowTo over 10 years
    The 3 links are not working anymore.