Copying a file to SHAREPOINT

Reply
Contributor
Posts: 27

Copying a file to SHAREPOINT

[ Edited ]

Hi! Hoping someone can get me over the last hurdle...

I need to pull a file from FTP and PLACE it in a Sharepoint directory

Got the FTP part done and the file copies to my local SAS directory.

 

Im stuck getting it out to the sharepoint. Ive tried to use Samba, and it completes (with no errors) but doesnt actually work

So I tried using PROC HTTP but its unable to find valid certification path to requested target

 

Im guessing it might be the url (i will xxx some parts out)

FILENAME req "CID.csv";
FILENAME resp "TEST.CSV";

PROC HTTP
URL="https://eng.sharepoint.xxxxx.com/Access/Access%20Mng%20%20Inv/Forms/Allitems.asp"
METHOD="POST"
IN=req
CT="application/JSON"
OUT=resp
WEUSERNAME="loginname"
WEBPASSWORD="thepassword"; RUN;

ERROR: javax.net.sslSSLHandshakeException....

So im thinking its not connecting/authorizing correctly. prob wrong URL? (I copy/pasted from the sharepoint view)

FYI I found that code somewhere

 

Thanks!!

 

PS: I just found a post about using cURL ... I will look into that as well

PROC Star
Posts: 2,369

Re: Copying a file to SHAREPOINT

Samba should work: You are just copying to a UNC path.

Have you tried copying manually to the same path?

Contributor
Posts: 27

Re: Copying a file to SHAREPOINT

[ Edited ]

Thats what i thought. I can map to it, "open with explorer", and copy to it that way... yet I try Samba and it doesnt work. Unless maybe im not getting the settings correct. I use Samba for copying to our share drives... maybe its a little different?

 

 

sample:

in windows its:

https://eng.sharepoint.company.com/Access/Access Sub folder Name/Subfolder

 

so In Samba I did:

 

X "cd /home/myname/CID; &SAMBA //eng.sharepoint.company.com MyPassWord -U MyUserName -D 'Access\ Access Sub folder\subfolder' -c 'prompt; put &FNAME'";

 

- I was just told that it may be a network issue as the Sharepoint is on a different server from SAS and does not allow some connections...

PROC Star
Posts: 2,369

Re: Copying a file to SHAREPOINT

A UNC path looks like this: \\server\share\subfolders

 

If you have such a path, check that the SAS server can access it by running:

filename DIR pipe "dir ""\\server\share\subfolders"" /s ";

data T;

  infile DIR;

  input;

  put _infile_;

run;

 

Replace the dir command by your own connection command to see what the OS returns.

 

If the path is accessible, the function fcopy() should do the trick.

If the only access is http, then this method is not usable obviously.

 

Contributor
Posts: 27

Re: Copying a file to SHAREPOINT

Well after hours of testing, trying, and pulling out my hair, it seems that It cannot be done this way on our systems. The Sharepoint system is locked down from any connection outside that network. Turns out we are setting up a system to be able to email the file to the folder in sharepoint... so Thanks for your help! I guess I just have to wait for now.

 

Ask a Question
Discussion stats
  • 4 replies
  • 148 views
  • 3 likes
  • 2 in conversation