Git Product home page Git Product logo

edu-assignments-graph-sdk's Introduction

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 [email protected] 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.

edu-assignments-graph-sdk's People

Contributors

ashwanibansal1 avatar cristobal-buenrostro avatar microsoft-github-operations[bot] avatar microsoftopensource avatar raghuchek avatar v-rmanda avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

edu-assignments-graph-sdk's Issues

Issues accesing Teams with Deletated scenario

Hi there,

I have configured my ogle migration app with the Delegated scenario. In the app registration I have entered the https://localhost, as er documentation.
When I try to sign in into Teams, to get the M365 Edu credentials, I receive an error:

AADSTS50011: The redirect URI 'http://localhost:53299' specified in the request does not match the redirect URIs configured for the application '80dd4d77-a15d-4437-bc42-83127fc454b3'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.