Writing to and reading csv and xls files on Sharepoint

Hi.

I’m using KNIME 3.5.2 and would like to know how to copy files from sharepoint to a local directory, and vice versa. Any minimum working examples would help. I’ve found other forums post unhelpful thus far.

1 Like

Hi there @ryno,

welcome to KNIME Community Forum!

Have you tried Web Service or REST approach for accessing SharePoint?
Here is a link to check: Accessing files through Sharepoint

To my knowledge having workflow example would require someone to share his SharePoint publicly so that won’t work…

There is feature request for this (internal reference: AP-11498) and will give +1 for you.

And if I may ask why not upgrade your KNIME? New features come in new versions…

Br,
Ivan

1 Like

Thanks for the response @ipazin.

I have looked into that but can’t seem to get that to work, and all of the forum entries seem to point back to the same two or three entries, all which state it should be possible. Unfortunately I’ve not had any success, so I’m at a point where I need to export locally and manually upload the files to sharepoint.

As to the why not updating - it’s a function of the version we’re running on other machines too so as to ensure compatibility across the business.

1 Like

Hi there @ryno,

I see. So what node are you using and what error (if any) are you seeing.

In that case I recommend upgrading version on all machines! If possible of course :smiley:

Br,
Ivan

Posting a response here for anyone still having difficulty connecting to Sharepoint Online.

In order to use REST requests in KNIME (when connecting to Sharepoint Online), you need to first obtain a token. This token needs to be passed along with the GET or PUT requests in order for Sharepoint Online to validate the request.

To obtain the token, you will use a POST request to the following address:
https://accounts.accesscontrol.windows.net/TENANT_ID/tokens/OAuth/2
where TENANT-ID can be retrieved either from a GET request, or from your Sharepoint admin.

You will also need the following parameters as part of the POST request:
GENERATED CLIENT-ID
GENERATED CLIENT-SECRET
RESOURCE (this is a constant for sharepoint - 00000003-0000-0ff1-ce00-000000000000)

For full details on how to get these parameters, refer to the following website:


You should be able to get these parameters from your admin.

To set up the POST request in KNIME, the Connection Settings tab must have URL as specified above (https://accounts.accesscontrol.windows.net/TENANT_ID/tokens/OAuth/2).
The Authentication tab can be left as None.
Create a Header Key in Request Headers: Set the Header Key to “Content-Type” (without the quotes), Header Value to “application/x-www-form-urlencoded” (without the quotes) and Value kind to Constant.

On the Request Body tab, use a constant body and set the value to the following:
grant_type=client_credentials
&resource=RESOURCE/TENANT-NAME.sharepoint.com@TENANT-ID
&client_id= GENERATED CLIENT-ID@TENANT-ID
&client_secret= GENERATED CLIENT-SECRET

where each of the uppercase parameters above needs to be replaced with the values previously obtained. The end result will look something like the following:

If all of the parameters are correct, the post request should return with a Status 200 (OK), and will return an access token. That access token can now be used with further REST requests.

3 Likes

@ryno thanks for sharing the solution :+1:
Really helpful!

@ipazin could you add an +1 from me as well for the request ? :slight_smile:

1 Like

Hi there,

glad you made it and tnx for sharing steps @ryno :+1:

Done @AnotherFraudUser!

Br,
Ivan

1 Like