How to use Microsotf Graph API to Upload File to Sharepoint Usign HTTP Request

Hello,
I’m currently working on an InHouse Office365 Library for my company. To do this we are using the Microsoft Graph API to gain speed, reliability and control over our activities.

I have every single important action developed and working, with the exception of the upload local file to sharepoint. I’m having a real hard time understanding how to use it.

On postman and HTTP Request Wizard I can get it to work reliably, using the following details:

Postman

HTTP Request Wizard

The problem I’m facing is that, whenever I try running the HTTP Request Activity, I can’t get the upload to work with files diferent from .pdf

The HTTP Request Activity is configured exactly like the requests above, with the single diference being that I have to use the “File Attachment” argument with a ICollection(Of ILocalResource) and the body format as application/xml. For some reason this is not working.

Does anyone have experience using Microsoft Graph via HTTP Request? Have you ever uploaded a file via HTTP Request?

Sorry for the lack of images, the forum seems to be bugged and won’t allow me to attach anything.

Hello @brunokkawano!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff

Hey everyone, after some research I found a solution to this problem. So to anyone who is wondering, I got my solution from this thread here:

HttpRequest upload file - Help / Forum - UiPath Community Forum

Refer to the invoke code described by Niranjan_Mahtole.

The summary of the solution is:

Use invoke code to call the API and attach the file as a binary array to the body, with body format application/octet-stream.

1 Like

Seems like you should just use the Office 365 activities that come from UiPath rather than reinventing the wheel.

@brunokkawano

Thank you for sharing.

I am curious, Have you ever tried to download attachments using Sharepoint API via HTTP request.

if yes, kindly share how.

Thanks!

@postwick It doesn’t work for attachments.

Hello, Paul! Our team has a couple reasons for using the Graph API directly.

The main one is that we are building different interactions to Microsft products not encompassed in the Integration Service!And since we now have projects using this API, we figured we could also extend the use for Sharepoint integration.
The other reason is we find that sometimes the integration service activities can feel a little inconsistent, and lack a couple features we would like, so we are implementing everything in house so we can have the most custom made activities for our needs.

Hey there, Sonali!

We have it working normally. The secret is to use the “Response attachment” Output argument on the HTTP Request Activity with your endpoint.

About the endpoint. There are many options, so I would just browse either the Microsof Graph Documentation page or other threads/forums, so you can chose the one you find the most suitable for you.

1 Like

You can build a custom Integration to ‘cover the gaps’ so to speak, managing your connections via the Integration Service is really nice instead of having to manage tokens in your own library.

Too late now I know, but food for thought for the future.
The Integration service stuff is for sure lacking alot of stuff, but especially now they started adding a generic ‘HTTP request’ activity for most connections you can now cover most of the gaps without re-inventing the wheel as was said.

Hi @brunokkawano

Thanks for sharing!

I am gonna try that, will reach out to you if face any issues.

Regards
Sonali

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.