Sharepoint upload document using REST API with Jquery.

%3CLINGO-SUB%20id%3D%22lingo-sub-1284033%22%20slang%3D%22en-US%22%3ESharepoint%20upload%20document%20using%20REST%20API%20with%20Jquery.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1284033%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20experts%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20used%20below%20link%20code%20for%20uploading%20documents%20on%20sharepoint%2C%3C%2FP%3E%3CP%3E%3CA%20title%3D%22Upload%20file%20using%20REST%20api%20with%20Jquery%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Fupload-a-file-by-using-the-rest-api-and-jquery%23running-the-code-examples%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Fupload-a-file-by-using-the-rest-api-and-jquery%23running-the-code-examples%3C%2FA%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3Ebut%20I%20am%20getting%20error%20when%20I%20upload%20any%20document%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%22error%22%3A%7B%22code%22%3A%22-2147024891%2C%20System.UnauthorizedAccessException%22%2C%22message%22%3A%7B%22lang%22%3A%22en-US%22%2C%22value%22%3A%22Access%20denied.%20You%20do%20not%20have%20permission%20to%20perform%20this%20action%20or%20access%20this%20resource.%22%7D%7D%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eplease%20help%20me%20out%20of%20this%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1286921%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20upload%20document%20using%20REST%20API%20with%20Jquery.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1286921%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EWhich%20example%20you%20tried%20from%20the%20link%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1287237%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20upload%20document%20using%20REST%20API%20with%20Jquery.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1287237%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F144422%22%20target%3D%22_blank%22%3E%40Sudharsan%20K%3C%2FA%3E%26nbsp%3BI%20have%20create%20HTML%20web%20resource%20on%20CRM%20form%20and%20I%20have%20added%20%3CINPUT%20type%3D%22%26quot%3Bfile%26quot%3B%22%20%2F%3E%20and%20on%20click%20of%20button%20I%20am%20calling%20function%20from%20code.%20But%20getting%20error.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1287253%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20upload%20document%20using%20REST%20API%20with%20Jquery.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1287253%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EThe%20example%20shown%20in%20the%20below%20link%20explains%20the%20use%20of%20SharePoint%20server%20and%20SharePoint%20online%20and%20then%20to%20communicate%20using%20REST%20API.%20From%20CRM%20I%20need%20to%20check%20how%20to%20access%20the%20SharePoint%20repositories.%20May%20I%20know%20which%20CRM%20version%20you%20are%20using%2C%20is%20it%20On-Prem%20or%20Online%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1288180%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20upload%20document%20using%20REST%20API%20with%20Jquery.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1288180%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F144422%22%20target%3D%22_blank%22%3E%40Sudharsan%20K%3C%2FA%3E%26nbsp%3BI%20am%20working%20with%20MS%20D365%20CRM%20online%20v9.1%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello experts, 

 

I have used below link code for uploading documents on sharepoint,

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-j...  

but I am getting error when I upload any document,

 

{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

 

please help me out of this issue.

 

Thanks in advance

4 Replies
Hi,
Which example you tried from the link?

@Sudharsan K I have create HTML web resource on CRM form and I have added <input type="file"> and on click of button I am calling function from code. But getting error.

Hi,
The example shown in the below link explains the use of SharePoint server and SharePoint online and then to communicate using REST API. From CRM I need to check how to access the SharePoint repositories. May I know which CRM version you are using, is it On-Prem or Online?

@Sudharsan K I am working with MS D365 CRM online v9.1