cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading file to Sharepoint Folder

john.hammond
Level 6
Good Morning all,

I'm looking to upload/copy/save an Excel file to a specific Sharepoint Folder. Firstly, my apologies in advance - I am by no means an expert in working with SharePoint. I'm aware that there is the Graph API for interacting with SharePoint, but I have absolutely no idea how that works in practice (is there an idiots guide somewhere as to how this integrates with Blue Prism?). I'd like to think that there was a simpler solution to this particular issue anyway - denoting a save path on SharePoint for the document from with the 'Save Workbook As' object within the Excel VBO - but I cannot seem to get this to work. 

So actually, I guess there are two questions that I currently have:
* Is there a simple way to save an Excel file to a specific folder on SharePoint? If so, how?
* How does Graph API work for someone who's not overtly familiar with SharePoint and indeed API's in general? The documentation is fine but could benefit from some example structures within Blue Prism.

Not sure if it over-complicates things, but the file(s) I'll be looking to upload will just under 6mb - from what I understand, there may be a 4mb limit on the Graph API Upload File action?

I should add: one thing I've seen mentioned is about uploading to OneDrive and then syncing to SharePoint, however unfortunately, my organisation has blocked this.

------------------------------
John Hammond
------------------------------
20 REPLIES 20

Neel1
MVP
Hello John - What we are doing as of now in my org is using the sync button for SharePoint file. but i see that is blocked for you.  this step is making our life much easy as every automation we have this requirement to work on SharePoint.

------------------------------
Neeraj Kumar
Technical Architect
------------------------------

ewilson
Staff
Staff
Hi @john.hammond,

Most of the straight upload functions in Microsoft Graph have relatively small file size limitations. 4MB seems to be the default. To address this, Microsoft supports a feature known as resumable uploads or upload sessions. An upload session is basically a dedicated temporary URI endpoint for you to upload any size file to. To use an upload session there are a series of requests that you make to Graph:

  1. Request creation of the upload session. Assuming this is successful, the new URI is returned to you.
    • You'll provide the following details:
      • Site ID - The unique ID of the specific SharePoint site.
      • Drive ID - The unique ID of the SharePoint drive that will hold the file.
      • Folder Path - The path within the SharePoint drive where the file will reside.
      • File Name - The name of the file as it will exist on SharePoint
      • Auth Token
  2. Upload the actual file using the new URI as the destination.
There's also an action available for canceling an upload session in case something has gone wrong.

There's an asset on the DX called Microsoft Graph API - SharePoint Upload Sessions that can be used for this actions. To use this connector you will need to have application registration within your Azure AD as well as a Client ID and Client Secret for the OAuth authentication and authorization. That app registration will also need the appropriate Microsoft Graph permissions applied to it. Generally this means Sites.ReadWrite.All​ when using Application Access credentials.

Hope this helps.

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

I have been dealing with a similar situation of trying to upload larger files to SharePoint. In working with the Graph API asset I'm having difficultly getting the Drive ID. I am not a SharePoint expert and I'm not sure how to go about getting that identifier, any directions on how to get the Drive ID would be appreciated. 

______________
 DJ Lombardo

------------------------------
Daniel Lombardo
------------------------------

Hello @Daniel Lombardo,

There are a few ways to get the Drive ID. The easiest is to use the Get Default Drive Details or Get All Drives actions on the Microsoft Graph - SharePoint connector. All you have to do is pass in the Site ID of the specific SharePoint site and it will return details of the drives associated with that site.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hello,

What about scenarios where the uploaded file are really big (for ex. 1 GB) and BluePrism returns a System.OutOfMemoryException?
I know this is more related to machine memory than to the objects themselves, but maybe someone has already solve this type of case?

Thanks

------------------------------
Kacper Sochar
------------------------------

Hi ,
I too have same kind of scenario which  runs in to several complications.
the best solution i believe is sync the Share point folder to machine where your robot runs , so you can just copy the files  and can avoid all steps to  access/upload to SP.

------------------------------
Krishna Elapavuluri RPA Solution Lead
TEchnology Consultant
DXC.technology
Asia/Kolkata
------------------------------

Hi @KacperSochar,

Yes, this is a limitation in the current implementation of the SharePoint Upload Sessions connector. Presently, it attempts to read the entire contents of the file into memory before chopping the binary array up into chunks for sending to SharePoint. We have an item in our backlog to change this behavior, and I hope to see that update pushed to DX in the next week or so.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

PvD_SE
Level 12
Hi John,

Alternative approach:
We use SharePointOnline (SPO) as well as OneDrive. If you have the same setup, then you could try this:
Once you have used a SPO link on your computer, it will probably have been mapped up within your OneDrive as well. As such, the OneDrive SPO link has a shortcut in style with:
C:\Users\Paul\OneDrive - Paul\SPO Folder\SPO Subfolder\...
 
Instead of having the process use SPO via a browser, it can use SPO via its shortcut. That way, you avoid interacting with an ever changing SPO interface that shows new popups every second week and requires you to login again and again without end, not to mention the infamous Sync button messing up your folders and files.

------------------------------
Happy coding!
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

Hah, cheers for this Paul - I literally tried this approach yesterday and had it work for the first time overnight! Thanks!

------------------------------
John Hammond
------------------------------