options set=SSLREQCERT="allow";
/* 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;
filename hdrs "/home/headers_sharepoint.txt";
filename Testing "/home/out_sharepoint.txt";
%let Test_URL = "http://spappfarm.intra.net/iapps/SAR/_api/web/lists/GetByTitle('test')/items";
proc http
url = &Test_URL.
out = Testing
method = "get"
headerout=hdrs
webusername="S123456"
webpassword="testpassword!!"
webauthdomain="test"
auth_negotiate;
run;
data _null_;
infile Testing;
input;
put _infile_;
run;
data _null_;
infile hdrs;
input;
put _infile_;
run;
%put HTTP Status code = &SYS_PROCHTTP_STATUS_CODE. : &SYS_PROCHTTP_STATUS_PHRASE.;
Hello Team,
i am trying to execute above proc HTTP code, to access the sharepoint URL to read the lists from it. for some reason am getting the 401 Unauthorized out file .
1. which user from below box , proc HTTP is using for authentication.
2. what will be fix for this ?
Value Name | Macro Variable Value | Purpose |
---|---|---|
_CLIENTUSERID | 'S123456' | Windows user ID in SAS EG |
_CLIENTUSERNAME | 'my name' | Windows user name in SAS EG |
_METAUSER | S123456 | SAS metadata user ID |
SYSUSERID | S123456 | SAS session host account |
Here is the out file :
HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/8.5
SPRequestGuid: 6f3e11a0-f343-5019-a75a-65092f2b13f2
request-id: 6f3e11a0-f343-5019-a75a-65092f2b13f2
X-FRAME-OPTIONS: SAMEORIGIN
SPRequestDuration: 2
SPIisLatency: 0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 15.0.0.4885
X-Content-Type-Options: nosniff
X-MS-InvokeApp: 1; RequireReadOnly
Date: Tue, 28 Dec 2021 15:48:01 GMT
Content-Length: 16
calling @ChrisHemedinger
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.