Issue with Uploading Image to SharePoint using HTTP Request Activity in UiPath

Hello UiPath Community,
I am facing an issue with uploading an image to a SharePoint portal using the HTTP Request activity in UiPath Studio. I have tried setting up the activity to send binary data, but I am not seeing an option to change the “AttachmentType” and the upload is not working. Here are the details of my problem:
Objective: Upload an image to a SharePoint folder using UiPath HTTP Request activity.
Issue: Unable to upload the image as binary data; the “AttachmentType” property is not modifiable, and the request is not successful.
API Endpoint: https://sharepoint_base_url/_api/web/GetFolderByServerRelativeUrl(‘site_path’)/Files/add(url=‘test.png’,overwrite=true)
Method: POST
Headers (included in the request):
Authorization: Bearer <access_token>
File Path: Local path to the image file (e.g., C:\path\to\image.png)
Error Message/Response:Response is 200, but when I check in sharepoint, the image metadata is there, but not the actual image.
Attempts to Resolve:
The Same call is working fine in postman when uploading an image from binary request body option.
Questions/Assistance Needed:
How can I correctly set up the HTTP Request activity to upload a file as binary data in UiPath?
Is there any additional configuration required for SharePoint file uploads that I might be missing?
Are there alternative methods within UiPath to perform this action successfully?
I appreciate any guidance or suggestions the community can provide. Thank you in advance for your help!
Best regards,
Bharath Choudhary

@Bharath_Choudhary,

Any reason for not using Office 365 activities for this? We have out of the box activities for this.

Thanks,
Ashok :slight_smile:

Hi @ashokkarale , the reason I am not using Office 365 activities is because I need to run this scripts in VM using the orchestrator, and the Office 365 won’t be installed in the VM to handle the actvity realted to Office 365.

@Bharath_Choudhary,

O365 activity don’t require anything to be installed on the machine. It totally works on the API.

Thanks,
Ashok :slight_smile:

Okay Thanks, I will try that.

Also @ashokkarale , can you please share the documentation for this api integration, As when I am trying to add any sharepoint api, it is asking me to connect to sharepoint and give access, that currently I can’t give as I want to do it for the company sharepoint site.

@Bharath_Choudhary,

Here you go:

Thanks,
Ashok :slight_smile:

Hi @ashokkarale , I am trying to do this, But it required me to setup a connection with sharepoint to enable the integration, But I can’t do that as I am doing it for the company and can’t integrate this,

is there any other way?

Thanks in advance.

@Bharath_Choudhary,

To integrate or use Office 365 API’s you will require Azure Directory Application. Otherwise frontend/Ui Automation is the only way.

Thanks,
Ashok :slight_smile:

But I have the sharepoint apis and I want to upload an image using that, why this simple activity not possible with http activity?

@Bharath_Choudhary,

For SharePoint specific I never tried but try this solution if it works for you.

Thanks,
Ashok :slight_smile:

Hi @ashokkarale , It is asking the same sharepoint activity only, and here the user is getting error when the api is made.

But for me, I am not getting any error, it shows 200 response for the sharepoint api from http activity, but the image is not loading properly from sharepoint, when the same image is uploaded via postman, it works fine.

@Bharath_Choudhary,

Can you share screenshot of your HTTP Request how you are passing the image to attachment property?

Uploading/attaching file to API endpoint is little bit different in HTTP Request than POSTMAN.

Thanks,
Ashok :slight_smile:

@ashokkarale , here are the screenshots which I attached shows the postman call and trying to replicate the same in http activity of the ui path.
Finally there is a screenshot which shows no preview and actually there is no photo event after download the one which I tried uploading from UI Path.



Please look inot them and let me know if you need any further details.