How You Can Use The Microsoft Graph API in C#
ฝัง
- เผยแพร่เมื่อ 9 ก.พ. 2025
- Join me in taking a look at how you can use the Graph API/SDK alongside C# in your projects. In this video we'll cover how to find the calls you need to make, what permissions you'll need, how to create an entreprise application, what packes are needed and a few examples of how you can call the API using the SDK in C#.
We're using a client secret to connect as an application, in case you want to see how to create a multi tenant application with access to multiple tenants, let me know and i'll create a video on that.
Source code used in the video: github.com/Blu...
Graph X-Ray: graphxray.meri...
Graph Permissions Explorer: graphpermissio...
Support Merill for the awesome tools
YT: / @merillx
Twitter: / merill
Authorization code flow:
learn.microsof...
learn.microsof...
PowerShell commands for 99 year secret:
$startDate = Get-Date
$endDate = $startDate.AddYears(99)
New-AzureADApplicationPasswordCredential -ObjectId "OBJECTID" -CustomKeyIdentifier "IMAP Secret" -StartDate $startDate -EndDate $endDate
This was a great video, I would like to see a video on multi tenant supported app registrations.
I really hope you haven't stopped making YT videos. I'm also in need of that multi tenant video, please.
Thank you for this. I was going around in circles with the Microsoft documentation but this helped a lot!
I'll save my resignation letter for another day!
Haha I'm glad to hear it helped!
Simple and easy to follow. Thank you!
Thank you! Very useful!
Please can you create a video on how to authenticate using delegate permission
Thank you :) Nice introduction.
Can you do a video for multitenant?
Do you maybe know if I can send emails via GraphApi to recepient with email domain from third party providers like Gmail?
I want to retrieve data from microsoft viva using microsoftgraph api and place them on the console in c#. How is this possible ?
Great Video!, Can you do a video creating a folder in One Drive with Microsoft Graph?
Thanks for the kind words!
In graph, onedrive is just the same as sharepoint so i would suggest taking a look at creating a folder in SharePoint with the graph api as shown in the below documentation.
learn.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http
someone can help me building up the graphclient with an already authenticated user's token?
great video mate!!
do you know how to add new users with licence and then add new usert to group?
Thanks for watching the video!
I would suggest looking at the ms documentation, they have examples on all three of those things.
learn.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http
learn.microsoft.com/en-us/graph/api/user-assignlicense?view=graph-rest-1.0&tabs=http
learn.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http
thanks for your video, can you make a video on how to upload a file to a SharePoint with MSGraph in C#?
Hmm that's not a bad idea for a short video. There's two graph endpoints for uploading files to sharepoint/onedrive, one for small files and one for big files
@@bluehippotech Can you give me those two endpoints?
I followed your video closely and went through all the steps. I get an error in GraphHandler row 33: return await GraphClient.Users[userPrincipalName].GetAsync() Error: Microsoft.Graph.Models.ODataErrors.ODataError: 'Exception of type 'Microsoft.Graph.Models.ODataErrors.ODataError' was thrown.' but no further information. What can be done to find it and correct it. Thanks
Maybe no user could be found with said user principal name?
Try returning all users instead and see if the connection works properly
same error
Any solutions to this? i get also ODataError :(
I got detailed error desc: insufficient privileges to complete the operation
I would suggest trying to return all users or checking the permissions on the app registration
How do I get all of the columns in a SharePoint list and their data? . Thank you
You would get the list using graph, the documentation on lists in SharePoint is quite good.
learn.microsoft.com/en-us/graph/api/list-get?view=graph-rest-1.0&tabs=csharp
Can you use the Graph API without a paid subscription to Azure?
I'm not quite sure what the purpose would be. If you're just testing stuff you can make a dev tenant, otherwise without a subscription it would be empty
LOVE YOU