is it possible or not Upload file to SharePoint Online from external application?

I'm looking to use some JavaScript with Jquery or angular to upload files from a asp.net or from another online app like CRM.

I manage to read data without problems, but look like uploading is throwing permission errors

is there any good tutorial\video\ git sample out there?

  • Can you provide details on how you read data? How do you authenticate into SPOnline from JS? – Prakash May 15 '16 at 14:38
  • Is below given solutions works for you? – Hardik May 16 '16 at 7:33
  • Is given solutions works for you? – Hardik May 16 '16 at 10:32

You can use jquery & REST API combined to upload a file to SharePoint online.

Below is the best example explained on MSDN:-

Upload a file by using the REST API and jQuery

  • 1
    What about authentication? It's an external application. – Derek Gusoff May 15 '16 at 18:09
  • Does it work for both online and on-prem? – SPforCRM May 16 '16 at 0:18
  • It is using REST Api... It will work online for sure.. – Hardik May 16 '16 at 1:11

You may want to go down with CSOM .NET route which enables you to pass credentials for SharePoint online which is not possible with JSOM or REST API. All the best!


Yes, we can do REST API POST call to SharePoint from outside of SharePoint i.e. external web site. Lets say your external website is "AAA" and sending data to SharePoint site i.e. "BBB" - so in order to authenticate in SharePoint we need to generate the client_id and client_secret from SharePoint site - then while writing the POST call to SharePoint we need to use the client_id and client_secret code.

Below are the steps how to generate "client_id" and "client_secret" from SharePoint:

In order to achieve this access - we need to generate a client_id and client_secret from "https://BBB.sharepoint.com" site and uses that code in "AAA" site while sending the data "BBB" site.

There is a long steps how to the generate the client_id and client_secret code.

Step 1: Register Add-In

Go to the this page of your BBB site https://.SharePoint.com/_layouts/15/appregnew.aspx

Here you will get: client id and client secret

Save this information in notepad.

Step 2: Grant Permissions to Add-In

Go to this page of your BBB site:


Enter the "Client ID" in the App ID field and click on Lookup button

Now enter the below permission request in XML format:

<AppPermissionRequests AllowAppOnlyPolicy="true">
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Read" />

Step 3: Retrieve the Tenant ID

In POST man tool do a GET request for this URL(BBB site):


From the Header section you will get the realm value which is nothing but your client ID.

So finally while you are sending the client id and client secret to the AAA site(your source site from where you are uploading the document), it should be in the below format:

client_id   ClientID@TenantID
client_secret   ClientSecret


client_id: 4b4276d0-74cd-4476-b66f-e7e326e2cb93@10267809-adcb-42b6-b103-c7c8190b3fed
client_secret: nuC+ygmhpadH93TqJdte++C37SUchZVK4a5xT9XtVBU=

Now when the other system here it is application "AAA site" performing the POST call to the "SharePoint site here it is https://BBB.sharepoint.com", they need to use these two client_id and client_secret key.

Detailed explanation is here:



Download the POST man tool from here https://www.getpostman.com/downloads/

Do the sample POST request(upload file) to SharePoint using this tool and the above client_id and client_secret code - then generate POST request API code whichever language suits for you almost all programming languages are available using the POST man tool - if you are working in C# - you can get the C# equivalent code for the POST call - then you can use the same piece of code in your actual application in Visual Studio or whichever tool you are using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.