Transfer file from /tmp/job-number/workflow/ to Sharepoint

Hello,

I use python script node to create some files in zip and normally put into the current directory (which is by default /tmp/job-numbers/workflowname/) and I want to transfer these files to Sharepoint using transfer node + sharepoint node but the transfer node cannot find the files. Do you have any tips on it ? Thank you.

Are you running this on your local computer using KNIME Analytics Platform or on KNIME Hub?

Can you create the files and potentially save to Current Workflow Data Area and see if Transfer File node can find it?

Can you maybe share a minimal example that’d make it much easier to help.

Hi @MartinDDDD thanks for your comment.
To clarify more details, I run this on KNIME Hub so the path files are not super clear on my side.
The only thing I found out is that I can create files (using python node script) on the current directory which is /tmp/job-numbers/workflowname/.
I don’t know if I can save them to current workflow data area, could I know the example of the path of it? I am not sure if this directory : /tmp/job-numbers/workflowname/ is just current workflow data area or current workflow area.
Actually what I could do is that I send the zip file to email using send email node and zip file path as flow variables for attachment url. But now I want to transfer this zip file to Sharepoint instead of sending an email by putting it as attachment.


This is the python script.
image
I don’t know what to put here in the transfer node.
Thank you

Hey there,

thanks for the additional details.

If I understand correctly you want to unzip a file and transfer the files in that zip to sharepoint.

The files are located in the root of the workflow that you run (I assume you will have build the logic somehow for the zip file to get there…).

I’d try to do it without python as python is not very good for handling path-type variables:

You can use a node “Decompress files”.

The top branch gets the path to the current workflow (similar to what you do in Python) and then in Column Expressions (legacy) the fileName is added:

You can replace the first line with what the real filename is (“files.zip” as per your example)

You use this Path variable to define your Source - the zip-file you want to extract.

The bottom branch connects to your SharePoint and you use that file system as a target… for now I assume that you know how to establish a connection to SharePoint…

If you don’t know - for Hub use you’d best connect via App ID and Client Secret (you can use Secrets Manager to store all this information). Note: You either need to be tenant admin or need a tenant admin to set this up for you.

I covered how to do this in my latest video:

Alternatively you can connect and store your token in a local file (not recommended as not secure…) using this node:

Here is the Workflow (note: was not able to test on Hub…):

xferfiles.knwf (87.9 KB)

1 Like