I need to programmatically retrieve a document from Sharepoint 2013 for use in an RPGLE program running on an IBM i. Has anyone ever done anything similar? At the very least, if I can get the document out of Sharepoint and onto a network file share I know how to grab it from there. I've explored many different possibilities but I don't know C# or .NET and I'm struggling to find something that I can adapt to work for me.
Update: I was able to achieve what I was trying to do by using Scott Klement's open source HTTPAPI in an RPG program:
Ctl-opt DftActGrp(*No);
Ctl-opt BndDir('HTTPAPI');
/include libhttp/qrpglesrc,httpapi_h
Dcl-s rc Int(10);
Dcl-s url Varchar(300);
Dcl-s ifs Varchar(256);
Dcl-s pwtype Char(1);
Dcl-s userid Char(50);
Dcl-s password Char(50);
// Turn on debugging for troubleshooting. It will write a debug log file
// to the IFS in /tmp/httpapi_debug.txt
http_debug(*ON);
url = 'http://sharepoint/path/to/file/thefile.pdf';
ifs = '/temp/myfile.pdf';
// Set password type for SharePoint's NTLM authentication requirement
pwtype = HTTP_AUTH_NTLM;
// Set user and password
userid = 'theuser';
password = 'thepassword';
// Set credentials for authentication
http_setAuth(pwtype: userid: password);
// Call HTTPAPI's routine to download the file to the IFS
rc = http_req('GET': url: ifs);
// End gracefully if error
if rc <> 1;
http_crash();
endif;
*inlr = *on;
More details can be found here.