I haven't tried exactly the thing you need to do, but I've had the "pleasure" of interacting with SP a couple of times.

I usually went with Soap::Lite as the module of choice, and was forced to use Authen::NTLM due to the proxy setup at work. Here is something that worked, printing first 10 records of a SP list, formatted as CSV. I must admit that much of this was borrowed from http://lifo101.wordpress.com/2012/05/08/sharepoint-and-ntlmv2-with-soaplite/.

#!/usr/bin/perl use v5.14; use Authen::NTLM; use SOAP::Lite; my %cfg = ( host => 'sp.hostname.net:80', # must include port endpoint => 'http://sp.hostname.net/tasks/_vti_bin/lists.asmx', user => '\\user', # must have leading backslashes pass => 'Pa$$w0rd', ); # enable NTLMv2 in Authen::NTLM ntlmv2(1); # syntax shortening of SOAP::Data methods sub name { my ($name, $value) = @_; my $d = SOAP::Data->name($name); return $d->attr($value) if (ref $value eq 'HASH'); return $d->value($value) if (defined $value); return $d; #otherwise } sub value { SOAP::Data->value(@_) } my $soap = SOAP::Lite ->proxy($cfg{endpoint}, keep_alive => 1, credentials => [$cfg{host}, '', $cfg{user}, $cfg{pass}]) ->default_ns('http://schemas.microsoft.com/sharepoint/soap/') ->on_action(sub { $_[0] . $_[1] }) # change default SOAPAction hea +der ->readable(1); # fetch the list my $list_name = '{B0101010-2323-3434-4545-565656565656}'; # Team tasks my $som = $soap->GetListItems( name(listName => $list_name), name(query => \value( name(Query => \value( name(OrderBy => \value( name('FieldRef' => {Name => 'Created', Ascending => 'F +alse'}), )), )), )), name(rowLimit => 10) ); die $som->faultstring() if defined $som->fault(); my @results = $som->dataof('//GetListItemsResult/listitems/data/row'); say "ID;Deadline;Owner;Task"; foreach my $data (@results) { my $item = $data->attr; say join(';', @$item{qw( ows_ID ows_Deadline ows_Owner ows_Task )} +); }

Still, If I had to do something like this now, I would probably look at SOAP::XML::Client, as it seems to have a nicer interface to it.

The worst part of the task is figuring out the xml query. I had it easy - I just went to my SP admins, armed with a bag cookies, and told them what I want to do. They figured out the xml query using SOAPUI, gave it to me, and ate my cookies. If this approach is available to you (and you have the cookies), it will make your task much easier.

regards,
Luke Jefferson


In reply to Re: SharePoint copy files with perl by blindluke
in thread SharePoint copy files with perl by jamesgerard1964

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.