I’ve working on a process where files are auto downloaded on server from gmail account and processed further. previously i was working with google drive attachments. Added a feature to download the attachments from onedrive as well. The files are received from company account of outlook. I’ve been stuck on this for a week now. I can’t download files through the onedrive link that’s recieved on my gmail. I’ve never worked with azure and MS graph APIs. Might be doing something wrong here. I tried from this link AccessSharedItems but it didn’t work. Got an error for “InvalidAudience”. Any help how can i do that or am i doing anything wrong here. I’m using client_credentials for authentication.
Here’s my code for authentication and to get item by the encodedUrl.
$tokenRequestContext = new ClientCredentialContext($tenantId,$clientId,$clientSecret);
$url = $this->encodeUrl($link['url']);
$scopes = ['https://graph.microsoft.com/.default'];
$graphServiceClient = new GraphServiceClient($this->tokenRequestContext, $scopes);
$file = $graphServiceClient->shares()->bySharedDriveItemId($url)->get()->wait();
Error Reponse
Permissions In Azure
FadiKhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.