Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda