========================
public void getOneDriveFiles(String accessToken){
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://graph.microsoft.com/v1.0/me/drive/root/children');
request.setMethod('GET');
String token = 'Bearer ' + accessToken;
request.setHeader('Authorization', token);
HttpResponse response = http.send(request);
// Parse the JSON response
if (response.getStatusCode() != 200) {
System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
System.debug('BODY ============================='+response.getBody());
} else {
System.debug(response.getBody());
}
}
답변 9개
Perfect! Seems like the MIME type of the file you're sending is invalid.