Using the AUTH_NEGOTIATE option looks like a good approach. I tried this: filename input "&PROJ_FS_F./sharepoint/input";
filename resp1 "&PROJ_FS_F./sharepoint/resp1";
filename resp2 "&PROJ_FS_F./sharepoint/resp2";
filename headers "&PROJ_FS_F./sharepoint/headers";
/* Touch, to get a token */
proc http
method='GET'
url='http://&base_url./sites/_api/lists'
headerout=headers
out=resp1
AUTH_NEGOTIATE
HEADEROUT_OVERWRITE;
run;
%echofile(headers);
/* Read the token from the header */
%global hcode;
%global hmessage;
%global token;
data _null_;
infile headers termstr=CRLF length=c scanover truncover;
input @'HTTP/1.1' code 4. message $255.
@'WWW-Authenticate: Negotiate ' loc $255.;
call symputx('hcode',code);
call symput('hmessage',trim(message));
call symput('token',trim(loc));
run;
%put &hcode. &hmessage.;
%put >>> &token.;
/* SharePoint API Documentation: CheckIn
url: http://site url/_api/web/GetFileByServerRelativeUrl('/Folder Name/file name')/CheckIn(comment='Comment',checkintype=0)
method: POST
headers:
Authorization: "Bearer " + accessToken
X-RequestDigest: form digest value
For Proc HTTP:
url="http://&base_url./sites/_api/web/GetFileByServerRelativeUrl('/ASK-TP-DS/Dokumente/Forms/test_jat.txt')/CheckIn(comment='Comment',checkintype=0)"
*/
/* SharePoint API Documentation: CheckOut
url: http://site url/_api/web/GetFileByServerRelativeUrl('/Folder Name/file name')/CheckOut(),
method: POST
headers:
Authorization: "Bearer " + accessToken
X-RequestDigest: form digest value
For Proc HTTP:
url="http://&base_url./sites/_api/web/GetFileByServerRelativeUrl('/ASK-TP-DS/Dokumente/Forms/test_jat.txt')/CheckOut()"
*/
/* prepare the input header: */
data _null_;
file input recfm=f lrecl=1;
put "Authorization: Bearer &token.";
put '0d'x'0a'x;
put "X-RequestDigest: form digest value";
run;
proc http
method='POST'
url="http://&base_url./sites/_api/web/GetFileByServerRelativeUrl('/ASK-TP-DS/Dokumente/Forms/test_jat.txt')/CheckOut()"
in=input
headerout=headers
out=resp2
AUTH_NEGOTIATE
HEADEROUT_OVERWRITE;
run;
%echofile(headers); and I got the following resp2: HTTP/1.1 200 OK
Server: Microsoft-IIS/7.5
Date: Thu, 08 Jun 2017 12:27:01 GMT
Connection: close Looks prety good, but nothing happend - means: no change in SharePoint. By the way: the response-Header does not look that friendly: HTTP/1.1 404
Server: Microsoft-IIS/7.5
SPRequestGuid: 5cf0e00b-a663-482a-b4c1-42071760016a
X-SharePointHealthScore: 0
WWW-Authenticate: Negotiate oYGzMIGwoAMKAQChCwYJKoZIgvcSAQICooGbBIGYYIGVBgkqhkiG9xIBAgICAG+BhTCBgqADAgEFoQMCAQ+idjB0oAMCAReibQRrCAS6VR4ZJINk+sDg9hyaIk/OKbEQr504a6UhphgnBdy1XnIO/DIMogBdcAM+xdfNvoBOheaA2gprUsmt/mVyes0bxZr/ADApYUwaApSFTuiN0kk1o5MM4M/G7INx6XKIQ5zWNSS7tLjlzoY=
Persistent-Auth: false
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 14.0.0.7175
X-MS-InvokeApp: 1; RequireReadOnly
Date: Thu, 08 Jun 2017 12:27:00 GMT
Connection: close
Content-Length: 100
... View more