<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MS-SharePoint via REST-API and NTLM-authentication with proc http in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365367#M64748</link>
    <description>Thanks for that quick tip. I tried that before, but as soon as I use this kind of syntax, the out remains empty and the header says "Content-Length: 0".&lt;BR /&gt;Looks like this shortcut is not working for me.</description>
    <pubDate>Thu, 08 Jun 2017 13:44:49 GMT</pubDate>
    <dc:creator>j_l_seagull</dc:creator>
    <dc:date>2017-06-08T13:44:49Z</dc:date>
    <item>
      <title>MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365055#M64724</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I'm trying to simply check in and out&amp;nbsp;some documents in a MS-SharePoint-environment. From a SAS-program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Environment: Window Server&lt;/P&gt;&lt;P&gt;EG: 7.1&lt;/P&gt;&lt;P&gt;SAS-Foundation: 9.04.01M4P110916&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the REST-API-documentation for the SharePoint and I read the great white papers written by&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Joseph Henry about how to use&amp;nbsp; RESTful services with SAS (SAS1927-2015 and SAS6363-2016).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;In the environment I&amp;nbsp;am working with, it seem I have to deal with the Windows&amp;nbsp;NTML-authentication.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Did anyone out there tried to authenticate with NTLM against a SharePoint-Server and can tell me how to?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;The most advanced try is as follows (I used the correct domain for &amp;lt;my-sharpointsite&amp;gt;):&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;proc http
method="GET"
url='http://&amp;lt;my-sharepointsite&amp;gt;/site/_api/web/lists("guid")/items?$select=Title,Products/Name&amp;amp;amp;$expand=Products/Name'
headerout=headers
out=resp
webusername="&amp;amp;username."
webpassword="&amp;amp;pwd."
HEADEROUT_OVERWRITE;
run;
%echofile(headers);&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;The response header looks like this (I shortened the string after NTML randomly,&amp;nbsp;because I don't know if it contains&amp;nbsp;the password in&amp;nbsp;base64 encoding or so):&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.5
SPRequestGuid: 3d5af452-6e18-4f51-a911-972d70d7c117
WWW-Authenticate: NTLM TlRMAAACAAIADgAAAAFgomivW0zcYRzy4cAAAIwAjABAAAAABgGxHQAAAA9FAFIARwBPAAIACABFAFIARwBPAAEAFABXAEUAQgBQAEUAAUgBQAC4ARQBSAEcATwADACgAVwBFAEIAATAAxADEAMwAuAGMAbwByAHAALgBlAHIAZwBvAAUAEgBSAE8ATwAEcAWm+HaLf0gEAAAAA
WWW-Authenticate: Negotiate
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 14.0.0.7175
X-MS-InvokeApp: 1; RequireReadOnly
Date: Wed, 07 Jun 2017 15:24:11 GMT
Content-Length: 0&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="2"&gt;As I found on the web (&lt;A href="https://www.innovation.ch/personal/ronald/ntlm.html" target="_blank"&gt;https://www.innovation.ch/personal/ronald/ntlm.html&lt;/A&gt;)&amp;nbsp;NTLM uses a 4-way handshake, but I don't know how to handle that with a SAS-program.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Maybe there is an even easier way to do that using the SingleSignOn capabilities in this environment? Any ideas?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365055#M64724</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-07T15:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365065#M64725</link>
      <description>&lt;P&gt;Have you &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=n0oei8gxdwze92n1d3mh1wjc5eo5.htm&amp;amp;locale=en" target="_self"&gt;tried AUTH_NTLM&lt;/A&gt; (requires SAS 9.4 M3 or later, I think)?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 16:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365065#M64725</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-07T16:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365070#M64726</link>
      <description>&lt;P&gt;I tried it right now&amp;nbsp;- no change of the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the point is: I think the reply-header told me, "you are on the right way with NTLM, here is some token or whatever" (see &lt;FONT size="2"&gt;"WWW-Authenticate: NTLM TlRMT....." in the response header&lt;/FONT&gt;). I only don't know how to go on with it.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 16:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365070#M64726</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-07T16:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365084#M64727</link>
      <description>&lt;P&gt;Where is the SAS session? Also on Windows? Local or remote? Or on Linux?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If Local, then I'd guess your windows connection could used. &amp;nbsp;If a remote Windows SAS, then you might need to have Trusted for Delegation enabled on the remote machine (Active Directory setting) to allow the credentials to pass across the network hop. &amp;nbsp;If Linux (or another UNIX), then maybe something else is needed -- the full NTLM negotiation, or leveraging a Kerberos setup. &amp;nbsp;I'm treading on thin knowledge here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I consider PROC HTTP to be like a built-in cURL for SAS programs, as it supports most of what a command-line HTTP client should do. &amp;nbsp;Sometimes finding an example of that can help you to transcribe the necessary options to the SAS version.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 16:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365084#M64727</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-07T16:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365096#M64728</link>
      <description>&lt;P&gt;Where you are running the SAS session is quite important.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NTLM is typically used by a User that is logged into a Windows machine and that same user is being used to access sharepoint. In this case, a username and password are not needed on the proc statement, since the current logged in user will be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are running from a Linux machine, then you are pretty much out of luck using NTLM, as it is a Microsoft specific auth.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 17:13:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365096#M64728</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-06-07T17:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365113#M64729</link>
      <description>&lt;P&gt;If you have SAS Enterprise Guide and your SAS session is on UNIX, then you might try this custom task that accompanies a SAS paper:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paper:&amp;nbsp;&lt;A href="http://support.sas.com/resources/papers/proceedings14/SAS063-2014.pdf" target="_self"&gt;Get data from a SharePoint List into a SAS data set&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Task:&amp;nbsp;&lt;A href="http://support.sas.com/documentation/onlinedoc/guide/customtasks/samples/ImportSharepointListTask.zip" target="_self"&gt;Link to task download&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a bit of a pain to set up, but when working it can help to automate this process.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 17:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365113#M64729</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-07T17:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365116#M64730</link>
      <description>I noticed that the response also inlucdes Negotiate as an auth type.&lt;BR /&gt;&lt;BR /&gt;Negotiate will work on linux systems as long as the kerberos libraries are installed.&lt;BR /&gt;&lt;BR /&gt;You can force using Negotiate by using the proc http option AUTH_NEGOTIATE</description>
      <pubDate>Wed, 07 Jun 2017 17:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365116#M64730</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-06-07T17:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365271#M64737</link>
      <description>&lt;P&gt;Hello Chris,&lt;/P&gt;&lt;P&gt;thanks fpr your reply.&lt;/P&gt;&lt;P&gt;I am working in an Windows only environment, but there is absolutely no chance to get visual studio or installed or even to install some user written dlls somewhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm pretty sure, that there&amp;nbsp;should be&amp;nbsp;a way with SAS proc http only.....&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 07:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365271#M64737</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T07:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365277#M64738</link>
      <description>I am running the session on a remote Windows server machine. So even if I am logged on to that machine I guess I have to send to the SharePoint service who I am in the proc statement.</description>
      <pubDate>Thu, 08 Jun 2017 08:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365277#M64738</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T08:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365328#M64741</link>
      <description>&lt;P&gt;If you're connected using your account on Windows, even on the remote Windows machine, you should not have to pass additional credentials. &amp;nbsp;Try running this program to verify your IDs (&lt;A href="http://blogs.sas.com/content/sasdummy/2010/03/15/multiple-identities-for-all-of-the-people-you-are/" target="_self"&gt;see more here&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* for use on Windows and Unix workspace servers */
%let _metauser = %scan(%sysget(METAUSER),1,'@');
/* for use on MVS, Stored Process, and Pooled Workspace servers */
/* %let _metauser = %scan(%sysfunc(getoption(METAUSER)),1,'@'); */
data ids;
  length name $ 16 purpose $ 40;
  label name="Value Name" purpose="Purpose";
  infile datalines dsd;
  input name purpose;
datalines;
SYSUSERID, SAS session host account
_CLIENTUSERID, Windows user ID in SAS EG
_CLIENTUSERNAME, Windows user name in SAS EG
_METAUSER, SAS metadata user ID
run;
proc sql;
  select t1.name,
    t2.value,
    t1.purpose
   from work.ids t1
   inner join sashelp.vmacro t2 on (t1.name = t2.name);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;On the remote machine, the account that runs the object spawner (that launches your SAS session) needs to be Trusted for Delegation on that machine. &amp;nbsp;See &lt;A href="https://support.sas.com/documentation/cdl/en/bisecag/69827/HTML/default/viewer.htm#p1uhz7klzwwvr8n1r51h0nhcw2zm.htm" target="_self"&gt;SAS admin doc here&lt;/A&gt;. &amp;nbsp;This allows Windows to pass your authentication to the next network-connected resource. &amp;nbsp;The same is required if using Windows authentication to connect from SAS to a SQL Server database, a mapped drive/UNC path, or a network printer.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 12:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365328#M64741</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-08T12:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365339#M64744</link>
      <description>&lt;P&gt;Using the AUTH_NEGOTIATE option looks like a good approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename input "&amp;amp;PROJ_FS_F./sharepoint/input";
filename resp1 "&amp;amp;PROJ_FS_F./sharepoint/resp1";
filename resp2 "&amp;amp;PROJ_FS_F./sharepoint/resp2";
filename headers "&amp;amp;PROJ_FS_F./sharepoint/headers";


/* Touch, to get a token */
proc http
  method='GET'
  url='http://&amp;amp;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 &amp;amp;hcode. &amp;amp;hmessage.;
%put &amp;gt;&amp;gt;&amp;gt; &amp;amp;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://&amp;amp;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://&amp;amp;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 &amp;amp;token.";
  put '0d'x'0a'x;
  put "X-RequestDigest: form digest value";
run;

proc http
method='POST'
url="http://&amp;amp;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);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and I got the following resp2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;HTTP/1.1 200 OK
Server: Microsoft-IIS/7.5
Date: Thu, 08 Jun 2017 12:27:01 GMT
Connection: close&lt;/PRE&gt;&lt;P&gt;Looks prety good, but nothing happend - means: no change in SharePoint.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way: the response-Header does not look that friendly:&lt;/P&gt;&lt;PRE&gt;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&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2017 12:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365339#M64744</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T12:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365343#M64745</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started that SAS-program and got the following output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Value Name Macro Variable Value Purpose &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_CLIENTUSERID&lt;/TD&gt;&lt;TD&gt;'e939334'&lt;/TD&gt;&lt;TD&gt;Windows user ID in SAS EG&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;_CLIENTUSERNAME&lt;/TD&gt;&lt;TD&gt;'Albrecht, Jörg (IVQB4D-EXTERN)'&lt;/TD&gt;&lt;TD&gt;Windows user name in SAS EG&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;_METAUSER&lt;/TD&gt;&lt;TD&gt;E939334&lt;/TD&gt;&lt;TD&gt;SAS metadata user ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SYSUSERID&lt;/TD&gt;&lt;TD&gt;E939334&lt;/TD&gt;&lt;TD&gt;SAS session host account&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is not really a surprise - what did you expected to see?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 12:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365343#M64745</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T12:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365345#M64746</link>
      <description>&lt;P&gt;Yep, that's about right. &amp;nbsp;Just making sure you weren't connected with some system account on the server session. &amp;nbsp;Looks like you've made a little progress. &amp;nbsp;Can you use any GET methods to retrieve meaningful information from your SharePoint resources?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365345#M64746</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-08T13:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365348#M64747</link>
      <description>&lt;P&gt;So why are you sending a bearer token while also using Kerberos?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 quick tip:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;an easier way to send the headers you were trying to send would be this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc http&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ....;&lt;/P&gt;
&lt;P&gt;headers&lt;/P&gt;
&lt;P&gt;"Authorization" = "Bearer &amp;amp;token."&lt;/P&gt;
&lt;P&gt;"X-RequestDigest" = "form digest value";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365348#M64747</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-06-08T13:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365367#M64748</link>
      <description>Thanks for that quick tip. I tried that before, but as soon as I use this kind of syntax, the out remains empty and the header says "Content-Length: 0".&lt;BR /&gt;Looks like this shortcut is not working for me.</description>
      <pubDate>Thu, 08 Jun 2017 13:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365367#M64748</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T13:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365382#M64749</link>
      <description>&lt;P&gt;Hi Chris, good idea.&lt;/P&gt;&lt;P&gt;I tried this instead of the last proc http step (see Post 8):&lt;/P&gt;&lt;PRE&gt;/* try to get folder entities - just to try a GET method

Microsoft API documentation:
url: http://site url/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')
method: GET
headers:
    Authorization: "Bearer " + accessToken
    accept: "application/json;odata=verbose" or "application/atom+xml"

For Proc HTTP:
url="http://&amp;amp;base_url./sites/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')"

*/

proc http
  method='GET'
  url="http://&amp;amp;base_url./sites/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')"
  headerout=headers
  out=resp2
  AUTH_NEGOTIATE
  HEADEROUT_OVERWRITE;
run;
%echofile(headers);&lt;/PRE&gt;&lt;P&gt;But the resp2-File gives no meaningful answer. Even though the status is 200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;HTTP/1.1 200 OK
Server: Microsoft-IIS/7.5
Date: Thu, 08 Jun 2017 13:51:40 GMT
Connection: close&lt;/PRE&gt;&lt;P&gt;So I definitely have no clue, what happens in this proc http and from&amp;nbsp;where it got the result...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 14:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365382#M64749</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T14:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365386#M64750</link>
      <description>&lt;P&gt;I am still not clear why you are using 2 form of authentication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are sending in a Bearer token (I am guessing this is Microsoft Claims based auth)&lt;/P&gt;
&lt;P&gt;and are also using NTLM or Kerberos.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your access token is still valid, try just using the token and add&amp;nbsp;AUTH_NONE to your proc statement.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 14:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365386#M64750</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-06-08T14:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365392#M64751</link>
      <description>&lt;P&gt;Thank you Joseph.&lt;/P&gt;&lt;P&gt;This is something I don't understand either. The REST-API documentation written by Microsoft told me to send that '&amp;nbsp;Authorization: "Bearer " + accessToken'&amp;nbsp; header.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you&amp;nbsp;want me to&amp;nbsp;try this?:&lt;/P&gt;&lt;PRE&gt;/* prepare the input header: */
data _null_;
file input recfm=f lrecl=1;
  put "Authorization: Bearer &amp;amp;token.";
  put '0d'x'0a'x;
  put "X-RequestDigest: form digest value";
run;


proc http
  method='POST'
  in=input
  url="http://&amp;amp;base_url./sites/_api/web/GetFileByServerRelativeUrl('/ASK-TP-DS/Dokumente/Forms/test_jat.txt')/CheckOut()"
  headerout=headers
  out=resp2
  AUTH_NONE
  HEADEROUT_OVERWRITE;
run;
%echofile(headers);&lt;/PRE&gt;&lt;P&gt;This results in an empty resp2 and a headers that says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.5
SPRequestGuid: 5f57611d-0ef9-4a30-a263-d5db0ca8bdf3
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 14.0.0.7175
X-MS-InvokeApp: 1; RequireReadOnly
Date: Thu, 08 Jun 2017 14:05:35 GMT
Content-Length: 0&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2017 14:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365392#M64751</guid>
      <dc:creator>j_l_seagull</dc:creator>
      <dc:date>2017-06-08T14:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365394#M64752</link>
      <description>Ok,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Try not using the bearer token.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am not an expert in SharePoint, but I have worked with it in the past and know that it can be very odd sometimes (like sending 200 responses with no content)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would suggest just trying the GET that you were doing before, but remove the Bearer token and try AUTH_NEGOTIATE.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Jun 2017 14:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/365394#M64752</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2017-06-08T14:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: MS-SharePoint via REST-API and NTLM-authentication with proc http</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/776303#M81147</link>
      <description>&lt;P&gt;I am trying to connect using Active Directory from Linux SAS to my on Premise SharePoint using CURL. I am able to do the command from my desktop, but am getting 401 authentication errors when trying to authenticate from ssh command line. Would it be easier to me to request a local id, instead of trying to connect with AD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curl -v --NTLM --user $USER -L "URL" --output file.xlsx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&amp;lt; HTTP/1.1 401 Unauthorized&lt;BR /&gt;&amp;lt; Server: Microsoft-IIS/8.5&lt;BR /&gt;&amp;lt; SPRequestGuid: 6fb9fc9f-e632-1097-77e6-b91901d368ed&lt;BR /&gt;&amp;lt; request-id: 6fb9fc9f-e632-1097-77e6-b91901d368ed&lt;BR /&gt;&amp;lt; X-FRAME-OPTIONS: SAMEORIGIN&lt;BR /&gt;&amp;lt; SPRequestDuration: 71&lt;BR /&gt;&amp;lt; SPIisLatency: 0&lt;BR /&gt;&amp;lt; WWW-Authenticate: Negotiate&lt;BR /&gt;* NTLM handshake rejected&lt;BR /&gt;* Authentication problem. Ignoring this.&lt;BR /&gt;&amp;lt; WWW-Authenticate: NTLM&lt;BR /&gt;&amp;lt; X-Powered-By: ASP.NET&lt;BR /&gt;&amp;lt; MicrosoftSharePointTeamServices: 16.0.0.4705&lt;BR /&gt;&amp;lt; X-Content-Type-Options: nosniff&lt;BR /&gt;&amp;lt; X-MS-InvokeApp: 1; RequireReadOnly&lt;BR /&gt;&amp;lt; Date: Mon, 25 Oct 2021 21:45:11 GMT&lt;BR /&gt;&amp;lt; Content-Length: 0&lt;BR /&gt;&amp;lt;&lt;BR /&gt;0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 21:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/MS-SharePoint-via-REST-API-and-NTLM-authentication-with-proc/m-p/776303#M81147</guid>
      <dc:creator>akhozan</dc:creator>
      <dc:date>2021-10-25T21:53:36Z</dc:date>
    </item>
  </channel>
</rss>

