microsoft / hack-together

Hack Together: Microsoft Graph and .NET is a hackathon for .NET developers to learn Microsoft Graph and Microsoft 365.
MIT License
523 stars 85 forks source link

Project: Azure Serverless File Conversion using Graph #41

Open nipunojha opened 1 year ago

nipunojha commented 1 year ago

Project name

AzureServerlessFileConverter

Description

Use Azure Functions, Graph and Onedrive to convert documents, ppts, excels to PDF

This repo is an attempt to use the world of Microsoft serverless technologies and using the Microsoft suite - Azure, Graph, Microsoft 365 to do the same.

Built on C#, the code relies on Azure Functions, GraphAPI, Sharepoint and OneDrive and handles conversion of files greater than 4MB

Repo URL

https://github.com/nipunojha/AzureServerlessFileConverter

Team members

me

waldekmastykarz commented 1 year ago

Great idea! Looking forward to seeing the code!

nipunojha commented 1 year ago

Closed by mistake! Code submitted.

waldekmastykarz commented 1 year ago

Hey @nipunojha, it seems like you're not using the Microsoft Graph .NET SDK which is one of the prerequisites for hacks in this hackathon. Would you mind updating the code? 😊

nipunojha commented 1 year ago

Lol...typical dev. Will try and change the code else will withdraw :D

waldekmastykarz commented 1 year ago

You've got an awesome solution. Please, don't hesitate to reach out if you get stuck moving the code over to the Microsoft Graph .NET SDK. We're here to help.

nipunojha commented 1 year ago

Thanks! Okay, I converted the large file upload using the graph sdk example here https://learn.microsoft.com/en-us/graph/sdks/large-file-upload?tabs=csharp. Couldn't find how to use the sdk to download and delete the items yet. Will try and convert those too

nipunojha commented 1 year ago

I am stuck at the moment facing issues with using the sdk to convert the file to pdf and need some assistance @waldekmastykarz

I tried the code from here, but my compiler doesn't recognize QueryFilter and suggested using Microsoft.TeamsFoundation.WorkItemTracking.WebApi.Models

image

I was also trying to check any unit tests which might help but couldn't something corresponding to this. (Will use the download large test as reference for the download option) https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/tests/Microsoft.Graph.DotnetCore.Test/Requests/Functional/OneDriveTests.cs

Package References:

 <PackageReference Include="Azure.Identity" Version="1.8.2" />
    <PackageReference Include="MediaTypeMap.Core" Version="2.3.3" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Graph" Version="5.0.0" />
    <PackageReference Include="Microsoft.Identity.Client" Version="4.50.0" />
    <PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.3.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
    <PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.170.0" />
tajbender commented 1 year ago

Wow, @nipunojha

this is soooo cool. May I use it in electrifier?

@waldekmastykarz Would it be possible for me to use his project es an add-on?

This way, we could help each other, too. Hack2gether, right?

Regards, thx, tajbender

nipunojha commented 1 year ago

Thanks @tajbender! Happy for you to use this if it is okay by @waldekmastykarz and rules permit :) Happy to collaborate with you on the graph bit of your solution

waldekmastykarz commented 1 year ago

Hey @nipunojha, the first thing that I saw is that in your project you're using the Microsoft Graph .NET SDK v5 while the documentation you're referencing is for .NET SDK v4. There are some breaking changes between v5 and v4 and I think you've just hit one of them. Here's more information about how to update the QueryOptions piece to the v5 SDK: https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/7a2be45d2cf37f18a32cc9a60d0edf441fd23a08/docs/upgrade-to-v5.md#query-options.

@tajbender perfectly fine to reuse parts of this solution by me with @nipunojha permission and the credits so that we can tell what are the unique pieces that you've built and what's reused.

Awesome work folks! Looking forward to seeing your hacks!

nipunojha commented 1 year ago

@waldekmastykarz Thanks for the pointer and reference. It helped and got me past the issue. I figured since i was doing large upload i should also do the large file download and use the unit test reference to implement the same. hopefully it is all good now

nipunojha commented 1 year ago

I hit a snag while testing. I am also running the functions on .net 6 and v4 runtime and facing issue at the creation of the graphClient https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1670

waldekmastykarz commented 1 year ago

I hit a snag while testing. I am also running the functions on .net 6 and v4 runtime and facing issue at the creation of the graphClient microsoftgraph/msgraph-sdk-dotnet#1670

Ouch, sorry to hear that. Would using an older version of the SDK be an option for you until we sort out how to use the SDK v5 on Azure Functions?

nipunojha commented 1 year ago

Not sure I will have time before the hackathon ends but will try. The code looks right, and the API version worked, so quite happy with the outcome even though I hit a snag with the sdk. I am happy to have participated in the hackathon and the solution and tried out the latest version of the graph sdk

Thanks, Nipun

On Thu, Mar 9, 2023, 10:45 PM Waldek Mastykarz @.***> wrote:

I hit a snag while testing. I am also running the functions on .net 6 and v4 runtime and facing issue at the creation of the graphClient microsoftgraph/msgraph-sdk-dotnet#1670 https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1670

Ouch, sorry to hear that. Would using an older version of the SDK be an option for you until we sort out how to use the SDK v5 on Azure Functions?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/hack-together/issues/41#issuecomment-1461877787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMNW67SISELSVMGTMZQXCTW3G7FZANCNFSM6AAAAAAVM6YFTA . You are receiving this because you were mentioned.Message ID: @.***>

waldekmastykarz commented 1 year ago

Hey @nipunojha, were you able to have another look at the SDK? Is there anything that we could help you with?

nipunojha commented 1 year ago

Nothing more at the moment. I had fun converting the solution to use the SDK. I will explore other options on the sdk too for a teams chat notification and email options. Bummer I couldn't complete the test with the .net 6 and functions runtime 4. Will surely keep an eye on the eye resolution and try again.

Thanks, Nipun

On Mon, Mar 13, 2023, 7:50 PM Waldek Mastykarz @.***> wrote:

Hey @nipunojha https://github.com/nipunojha, were you able to have another look at the SDK? Is there anything that we could help you with?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/hack-together/issues/41#issuecomment-1465733024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMNW674RLKO6FVZWJL5WYLW33NVTANCNFSM6AAAAAAVM6YFTA . You are receiving this because you were mentioned.Message ID: @.***>