This repo is a set of code samples that will guide you to easily and quickly integrate the Microsoft Graph SDK into your applications in order to start building third party solutions for Microsoft EDU assignments service.
These samples also demostrate assignments service functionality exposed through the Microsoft Graph SDK, such as work with classes, users, assignments, submissions, resources and work with any of the EDU APIs. Using Microsoft Graph SDK we can perform any operation supported by graph SDK, not just limited to assignments.
- An EDU tenant for Azure Active Directoy authentication. Follow these instructions to get set up. You will need some info from the tenant created when filling the
appsettings.json
file in the samples. - Visual Studio 2022 or Visual Studio Code.
-
Open microsoft-graph-sdk.sln in Visual Studio.
-
Locate the file
appsettings.json
under MicrosoftEduGraphSamples project in Solution Explorer. Replace the contents of that file supplying your values as appropriate:{ "tenantId": "YOUR_TENANT_ID", "appId": "YOUR_APPLICATION_ID", "secret": "YOUR_SECRET", "classId": "YOUR_CLASS_ID", "teacherAccount": "YOUR_TEACHER_ACCOUNT", "studentAccount": "YOUR_STUDENT_ACCOUNT", "password": "YOUR_PASSWORD" }
- tenantId: Look for it in Azure portal.
- appId: Create a new app or take any existing in your Azure portal.
- secret: Look for it in your app registration in Azure portal.
- classId: Create a new class team or take it from an existing one.
- teacherAccount: Any class owner account
- studentAccount: Any member from the class.
- password: Your account's password.
Important
Do not commit any references that contain secrets into source control, as secrets should not be made public.
-
Right-click on the solution in the Solution Explorer and choose Restore Nuget Packages.
-
Run Debug > Start Debugging or just press F5.
It is a set of C# class libraries, those classes contain the actual calls to the Microsoft Graph SDK and each class contains only methods related to an specific entity; for instance User, GraphClient, Assignment, Submission and so on.
All the methods added in those classes can be used into your application.
This project works with these nuget packages:
- Azure.Identity (1.6.1).
- Microsoft.Graph.Beta (latest 5.XX.X) for Beta.
- Microsoft.Graph (latest 5.XX.X) for V1.0.
NOTE: make sure you install only the package needed according to the desired version, the project is using
Microsoft.Graph
package forv1.0
by default. Both packages (Microsoft.Graph
andMicrosoft.Graph.Beta
) cannot be installed at the same time.
Go to menu View / Other Windows / Package Manager Console, and copy and run the script below according to the version you want to switch to.
- Switch to V1.0
Uninstall-Package Microsoft.Graph.Beta -Project MicrosoftEduGraphSamples
Uninstall-Package Microsoft.Graph.Beta -Project MicrosoftGraphSDK
Install-Package Microsoft.Graph -Version 5.21.0 -Project MicrosoftEduGraphSamples
Install-Package Microsoft.Graph -Version 5.21.0 -Project MicrosoftGraphSDK
- Switch to Beta
Uninstall-Package Microsoft.Graph -Project MicrosoftEduGraphSamples
Uninstall-Package Microsoft.Graph -Project MicrosoftGraphSDK
Install-Package Microsoft.Graph.Beta -Version 5.44.0-preview -Project MicrosoftEduGraphSamples
Install-Package Microsoft.Graph.Beta -Version 5.44.0-preview -Project MicrosoftGraphSDK
This project provides Microsoft EDU code samples on how to use the methods from the class library. All the samples are developed in a Workflow structure to easily guide you and show you how to catch the responses and use the results.
Use the Program.cs
file to test any of the current workflows.
-
Add a project reference.
-
Install/uninstall nuget packages as needed.
- Microsoft.Graph.Beta (latest 5.XX.X) for Beta.
- Microsoft.Graph (latest 5.XX.X) for V1.0. Installed by default.
-
Create an instance of the class you want to test.
Submission submission = new Submission(config);
- Call the desired workflow method.
await submission.ReassignWorkflow();
Sample Name | Description | C# | Permissions | |
---|---|---|---|---|
1 | Reassign submission | Sample showing how the teacher creates an assignment and then publish it; the student submit his work and then teacher reassign it with feedback. | View | Delegated |
2 | Filter archived and deleted classes from assignments | Get me assignments from active and non-archived classes. | View | Delegated |
3 | Get assignment submissions using batch request | Since as a teacher you can't expand submissions, you will have to request every assignment for submissions on it. This SDK sample is to illustrate on how you can do this in a single batch request. | View | Delegated |
4 | Assignment evolvable enums | Evolvable enums is a mechanism that Microsoft Graph API uses to add new members to existing enumerations without causing a breaking change for applications. | View | Delegated |
5 | Classwork Module | The sample shows how the teacher creates a module and attach resources and assignments. | View | Delegated and Application |
- For reference documentation visit the Microsoft Graph SDK reference.
- For other documentation, go to Working with education APIs in Microsoft Graph.
- File an issue via Github Issues.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.