Skip to content

microsoft/edu-assignments-graph-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignments Code Samples using Microsoft Graph SDK

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.

Prerequisites

Usage

  1. Open microsoft-graph-sdk.sln in Visual Studio.

  2. 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"
    }

Important

Do not commit any references that contain secrets into source control, as secrets should not be made public.

  1. Right-click on the solution in the Solution Explorer and choose Restore Nuget Packages.

  2. Run Debug > Start Debugging or just press F5.

Project structure

MicrosoftGraphSDK

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:

NOTE: make sure you install only the package needed according to the desired version, the project is using Microsoft.Graph package for v1.0 by default. Both packages (Microsoft.Graph and Microsoft.Graph.Beta) cannot be installed at the same time.

Scripts to switch between versions in Visual Studio 2022

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

MicrosoftEduGraphSamples

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.

  1. Add a project reference.

    • Right click on the MicrosoftEduGraphSamples project.
    • Add / Project Reference ...
    • Check the MicrosoftGraphSDK project. Project references
  2. 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.
  3. Create an instance of the class you want to test.

    Submission submission = new Submission(config);
  1. 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

Need help?

Contributing

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 opencode@microsoft.com with any additional questions or comments.

Trademarks

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.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published