[Detroit-pm] What up, brudder?
Bill Hess
bhess at techrg.com
Wed Dec 9 07:41:07 PST 2009
Howdy All - I had to write up some info on my Sharepoint interaction
with Perl for my customer - so thought this might come in handy for some
of you as well...
Please let me know if you have any questions - Thanks...
Bill Hess
Technology Resource Group
Office: 248.546.6900 x12
Fax: 248.546.7310
Mobile: 248.703.1196
Here is some info on using CURL (http://curl.haxx.se/) to upload files
to a SP Document Library. CURL is a command line tool that supports a
bunch of file transfer protocols - namely HTTP/HTTPS in this case. The
reason this works is because SP supports WebDAV by default:
http://www.webdav.org/
http://en.wikipedia.org/wiki/WebDAV
Microsoft calls WebDAV - "Web Folders" - which you may have heard of
before...
Using CURL is simple once you have a copy of it - it is included with
all Linux distros that I know of - we are using CentOS 5.3 - which is
really Redhat Enterprise Linux (RHEL) 5.3
There are pre-built versions of CURL on http://curl.haxx.se/ for pretty
much any OS you can think of...
curl --ntlm -u DOMAIN/USERID:PASSWORD -T FILE
https://sharepoint_server_hostname/sites/it_sharepoint/demo/M1%20Test%20%20Crimp%20Spec/
* --ntlm tells CURL to use MS authentication
* DOMAIN/USER:PASSWORD is the MS user to use to login to SP
Typically on Windows you would use a backslash \ - but on the UNIX
cmd line this is the escape char - so we use the front slash /
- not sure which to use if running on CURL on Windows - but you
have a 50/50 shot to get it right...
* FILE is the path/name of the local file you want to upload
* And the URL is the SP URL - you can get this by just going to the
SP site in your web browser and copy/paste the URL - note the %20
is used for each single spaces.
o Actually - the first test site I created I named "M1 Test -
Crimp Spec" and SP decided to not use the '-' in the URL but
kept each space on either side of the '-'. So if you have
a SP site that has wacky chars in it - pay close attention
to the URL...
o I also figured out if the SP site is renamed - its URL stays
the same - so if I renamed my site to "Purple Brick" the
URL will stay the same...
o IMPORTANT - also note the last front slash '/' - I pulled
my hair out for a few hours before I got lucky and tried it
with this and it worked. I have also seen this trailing
front slash issue with other WebDAV servers that I have
worked with in the past...
To see the SOAP methods available to you - you should be able to use
your web browser by entering an equivalent URL for your SP site:
https://your_sharepoint_host/sites/demo/_vti_bin/Lists.asmx
This will show you the Methods to use working with SP Lists
The attached Perl programs are:
* soap21.pl - Walk thru a SP site and dump pretty much everything we
can get - I used this as a test/reverse engr/debugging early on...
* soap4.pl - Updates some attrs on a single item
o Need to construct some simple XML which is passed in the
SOAP call - the XML says which attrs to change and the new
values to use
* soap5.pl - Query a list for an Item
o Need to construct XML for the Query
* soap6.pl - Query for a SP subfolder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/detroit-pm/attachments/20091209/4ecd46ef/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sharepoint_perl_soap.zip
Type: application/x-zip-compressed
Size: 6607 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/detroit-pm/attachments/20091209/4ecd46ef/attachment.bin>
More information about the Detroit-pm
mailing list