An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @hirenkumar patel ,
Yes, you can use Microsoft Graph for this scenario.
For uploading files to OneDrive from an ASP.NET Core web app, the Microsoft Graph upload session approach is relevant, especially if the file may be large. The Graph SDK creates an upload session and uploads the file in smaller slices instead of sending the whole file in one request.
You can refer to this Microsoft Learn article here: Upload large files using the Microsoft Graph SDKs
The C# sample in that article shows the main flow:
- Open the file stream.
- Create an upload session for the target OneDrive path.
- Use
LargeFileUploadTask<DriveItem>to upload the file. - Optionally track progress and handle errors.
Please also make sure your app authentication and Microsoft Graph permissions are configured correctly for the OneDrive account you want to upload to. For example, if uploading to the signed-in user’s OneDrive, you would usually work with /me/drive; if uploading to another user or shared drive, the Graph path and permissions may be different.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.
Thank you.