in reply to upload files from UX FileSystem to a Sharepoint Location
I do pretty much exactly this (although I'm taking a file from Crystal Reporting and posting it to a Sharepoint document library). WebDAV is indeed the way to go - I originally just wrote this code to compile up with PAR so I could give people a command line tool they could use in their scripting, hence it's a little over engineered.
It's worth pointing out that in Sharepoint 2007 you can also email enable document libraries, so you can simply email an attachment and it just appears in the right place...
#!c:/perl/bin/perl.exe # Command line WebDAV client use strict; use warnings; use Getopt::Long; use HTTP::DAV; my ( $source, $destination, $username, $password ); GetOptions ('source=s' => \$source, 'destination=s' => \$destination, 'username=s' => \$username, 'password=s' => \$password, ); unless ( $source && $destination && $username && $password ) { print "Error: Missing parameters\n\n"; get_help(); exit(1); } my $dav = new HTTP::DAV; $dav->credentials( -user =>$username, -pass =>$password, -url =>$destination, ); $dav->open( -url=>$destination ) or die("Couldn't open $destination: " .$dav->message . "\n"); if ( $dav->put( -local => "$source", -url => $destination ) ) { print "\nSuccessfully uploaded $source to $destination\n"; } else { print "Put failed: " . $dav->message . "\n"; } sub get_help { print <<"HEREDOC"; Perl WebDAV client. Usage: webdav.exe --source [path to source file(s), accepts regex] --destinat +ion [url to WebDAV server] --username [your username, prefix with domain. e.g. domain\usernam +e] --password [your password] HEREDOC }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: upload files from UX FileSystem to a Sharepoint Location
by MH (Initiate) on May 01, 2007 at 19:46 UTC | |
|
Re^2: upload files from UX FileSystem to a Sharepoint Location
by mmertel (Initiate) on Mar 25, 2008 at 20:27 UTC | |
|
Re^2: upload files from UX FileSystem to a Sharepoint Location
by lvirden (Novice) on Jun 02, 2011 at 11:44 UTC |