admin管理员组文章数量:1394090
All the sample code I can find for PHP + MS Graph relate to v1 which used a Graph object. Version 2 now uses a GraphServiceClient and the samples on MS make no sense to me at all. What I want to do is offer the ability for users of my Web Application the ability to store and retrieve documents using OneDrive instead of a database. I have created the multi-tennant application on my account with hopefully the right permissions. And that's as far as I have got. I would appreciate if anyone can point me at a site that has sample code using V2 of MS Graph on how to achieve that. I could be just too dumb, but MS seem to have made everything so complex.
The steps I imagine are as follows assuming I have an iframe where I list the files the user has uploaded to OneDrive thru my app. Metadata of the files are stored and indexed in my own database table. To upload a file they drag-drop a file on the page or browse and upload.
- Step 1: get them to sign into OneDrive as their tenant by calling GraphServiceClient - with what sort of tokenRequestContext? Do I have to provide their tenant ID?
- Step 2: wait for Graph to call the redirectUri, and store the token it provides in users Session variable?
- Step 3: write an entry in the database table with metadata and get the unique ID to the file
- Step 4: Upload the potentially large file by calling LargeFileUploadTask, file named with the ID from Step 3 for later retrieval. Does it matter if file size is less than 3mb?
Presumably steps 1 and 2 can be skipped if the oauth token exists in their session when next they upload a file, or do I do I have to do that anyway to check it hasn't timed out? The bit about maintaining your own InMemoryAccessTokenCache confuses me. Is that required? If I can figure that out, then I guess the download process should be easy.
本文标签: Microsoft Graph API v2Upload and Downlod files fromto OneDrive using PHPStack Overflow
版权声明:本文标题:Microsoft Graph API v2 - Upload and Downlod files fromto OneDrive using PHP - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744688649a2619856.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论