OneDrive Filepicker SDK kan worden gebruikt om Bestanden op te halen van OneDrive die je kan gebruiken om te laten zien als shareable link of downloaden als bestand. Hier zijn de stappen voor het Instellen OneDrive FilePicker Stap 1: Het registreren van toepassing op https://apps.dev.microsoft.com/, Een redirect URL van een pagina op uw website (u dient toe te voegen OneDrive.js op die pagina). Na het registreren van de App krijg je een toepassings-id. Stap 2: Gebruik OneDrive picker als volgt: <script type="text/javascript" src="https://js.live.net/v7.2/OneDrive.js" async="async"></script> <script type="text/javascript"> launchOneDrivePicker = function(that) { var odOptions = { clientId: "YOUR_APPLICATION_ID", action: "query", multiSelect: false, advanced: { redirectUri: "https://yourCommonRedirectUri.com", }, openInNewWindow: true, success: function(response) { $.each(response.value, function(index, value) { var url = response.apiEndpoint + 'drives/' + value.parentReference.driveId + '/items/' + value.id; $.ajax({ 'url': url, beforeSend: function(request) { request.setRequestHeader("Authorization", 'Bearer ' + response.accessToken); }, success: function(result) { // console.log(result); var resultData = { 'url': result['@microsoft.graph.downloadUrl'], // this returns shareable url of file 'name': result['name'], // this returns file name }; }, error: function(xhr) { }, }); }); }, cancel: function() { // called when user cancels popup action }, error: function(e) { // called when error in connecting to OneDrive api } }; OneDrive.open(odOptions); //launches file picker }; </script> 12345678910111213141516171819202122232425262728293031323334353637383940414243 <script type="text/javascript" src="https://js.live.net/v7.2/OneDrive.js" async="async"></script> <script type="text/javascript"> launchOneDrivePicker = function(that) { var odOptions = { clientId: "YOUR_APPLICATION_ID", action: "query", multiSelect: false, advanced: { redirectUri: "https://yourCommonRedirectUri.com", }, openInNewWindow: true, success: function(response) { $.each(response.value, function(index, value) { var url = response.apiEndpoint + 'drives/' + value.parentReference.driveId + '/items/' + value.id; $.ajax({ 'url': url, beforeSend: function(request) { request.setRequestHeader("Authorization", 'Bearer ' + response.accessToken); }, success: function(result) { // console.log(result); var resultData = { 'url': result['@microsoft.graph.downloadUrl'], // this returns shareable url of file 'name': result['name'], // this returns file name }; }, error: function(xhr) { }, }); }); }, cancel: function() { // called when user cancels popup action }, error: function(e) { // called when error in connecting to OneDrive api } }; OneDrive.open(odOptions); //launches file picker }; </script> Opmerking: U kunt gebruik enkele redirect URL in plaats van meerdere bij het gebruik van bestandskiezer op vele webpagina ‚ s. Het opgeven van geavanceerde optie zoals: advanced: { redirectUri: "https://yourCommonRedirectUri.com", }, 123 advanced: { redirectUri: "https://yourCommonRedirectUri.com", }, Hier is de Officiële documenten en handige links voor OneDrive File Picker: https://dev.onedrive.com/sdk/js-v72/js-picker-open.htm https://github.com/OneDrive/onedrive-api-docs Tag(s) filepicker OneDrive