Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
Onedrive list files in folder javascript

I am trying to list all files in a folder on my onedrive using ajax. Is there universal url for this or do I need to go through their picker? Like google drive url for example:

var url = "https://www.googleapis.com/drive/v3/files?q='" + FOLDER_ID + "'+in+parents&pageSize=1000&key=" + API_KEY

$.ajax({
        url: url,
        dataType: "jsonp"
    }).done(function(media) {

  
    }).fail(function(jqXHR, textStatus, errorThrown) {
    
    }); 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I believe your goal is as follows.

  • You want to retrieve the file list in the specific folder of OneDrive using ajax.

In this case, how about the following modified script?

Modified script:

In this modified script, the file list is retrieved from the specific folder using Graph API. In this case, the access token is required to be used. When the access token is not used, an error like InvalidAuthenticationToken occurs even when the folder is publicly shared. Please be careful about this.

const folderName = "### folder name ###";
const driveId = "### your drive ID ###";
const url = `https://graph.microsoft.com/v1.0/drives/${driveId}/root:/${folderName}:/children`;
const accessToken = "### your access token ###";
$.ajax({
  url: url,
  headers: {"Authorization": "Bearer " + accessToken}
}).done(function(media) {
  console.log(media)
}).fail(function(jqXHR, textStatus, errorThrown) {
});
  • Also, you can retrieve the file list from the other endpoint as follows. In this case, drive id is not used.

      const folderName = "### folder name ###";
      const url = `https://graph.microsoft.com/v1.0/drive/items/root:/${folderName}?expand=children`;
    

References:

  • Authentication and authorization basics for Microsoft Graph
  • Working with files in Microsoft Graph
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda