Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I upload a document to SharePoint with Perl?

I have a Perl app that runs some perforce operations, in the end I would like it to upload the results to SharePoint website.

  • What is the simplest Perl script that can accomplish a task of adding a document to SharePoint?

The script would need to run on Solaris and use as few as possible external libraries as possible (definitely pure classic Perl) getting anything additional installed on these unix boxes is a pain and would have to be done by remote team.

If this can uploading document can easily be done with wget, that would be of interest too. Anyways, I am looking for 1 or a couple liner that's easy to understand.

UPDATES based on comments:

  • Perl Mechanize sounded like a good idea, but for some reason I am not able to authenticate, Error GETing http://sharepoint Unauthorized ....

I had this:

my $m = WWW::Mechanize->new(); 
$m->credentials($user => $pass); 
$m->get($url);

But mechanize won't authenticate against sharepoint for some reason.

  • Does anybody have a link or a sample on how to use sharepoint webdav from unix via perl?

I installed and tried to open my typical sharepoint site via "dave" webdav browser, but I get ** Unauthorized. ** error.

  • How to solve it with the webdav approach with perl on unix?
like image 743
Ville M Avatar asked Jan 30 '09 01:01

Ville M


2 Answers

This sounds like a job for WWW::Mechanize. It has excellent support for dealing with forms.

like image 178
Leon Timmermans Avatar answered Sep 20 '22 16:09

Leon Timmermans


Just found an easy way on windows from perlmonks forum:

http://www.perlmonks.org/?node_id=527182
under Windows, you can access a sharepoint site via a UNC name. The URL:
sharepoint.domain.dom/sites/Roboticus/Test
is accessible via:
\\sharepoint.domain.com\sites\Roboticus\Test

just adding as answer to myself, now I got to figure out how to script this from Perl and whether there is way to do the same from script running on unix.

like image 33
Ville M Avatar answered Sep 20 '22 16:09

Ville M