Redigera

Dela via


Update learningCourseActivity

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Update the properties of a learningCourseActivity object.

Note: Learning course activities can be managed by a provider only when isCourseAcitvitySyncEnabled is set to true. To update the value, use the Update learningProvider method.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Not supported. Not supported.
Delegated (personal Microsoft account) Not supported. Not supported.
Application LearningAssignedCourse.ReadWrite.All LearningSelfInitiatedCourse.ReadWrite.All

HTTP request

PATCH /employeeExperience/learningProviders/{registrationId}/learningCourseActivities/{learningCourseActivityId}

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, use @odata.type to specify the type of learningCourseActivity resource (learningAssignment or learningSelfInitiated), and include the properties of that type to update.

The following table lists the properties that you can change for an assigned learning course activity (learningAssignment).

Property Type Description
assignedDateTime DateTimeOffset Assigned date for the course activity. Optional.
assignmentType assignmentType The assignment type for the course activity. Possible values are: required, recommended, unknownFutureValue. Required.
completedDateTime DateTimeOffset Date and time when the assignment was completed. Optional.
completionPercentage Int32 The percentage of the course completed by the user. If a value is provided, it must be between 0 and 100 (inclusive). Optional.
dueDateTime DateTimeOffset Due date for the course activity. Optional.
notes String Notes for the course activity. Optional.
status courseStatus The status of the course activity. Possible values are notStarted, inProgress, completed. Required.

The following table lists the properties that you can change for a self-initiated learning course activity (learningSelfInitiated).

Property Type Description
completedDateTime DateTimeOffset Date and time when the assignment was completed. Optional.
completionPercentage Int32 The percentage of the course completed by the user. If a value is provided, it must be between 0 and 100 (inclusive). Optional.
status courseStatus The status of the course activity. Possible values are: notStarted, inProgress, completed. Required.
startedDateTime DateTimeOffset The date and time when the self-initiated course was started by the learner.

Response

If successful, this method returns a 204 No Content response code.

Examples

Example 1: Update an assigned learning course activity

Request

The following example shows the request.

PATCH https://graph.microsoft.com/beta/employeeExperience/learningProviders/01e8f81b-3060-4dec-acf0-0389665a0a38/learningCourseActivities/8ba2228a-e020-11ec-9d64-0242ac120003
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.learningAssignment",
  "assignedDateTime": "2021-05-11T22:57:17+00:00",
  "assignmentType": "required",
  "assignerUserId": "cea1684d-57dc-438d-a9d1-e666ec1a7f3d",
  "completedDateTime": null,
  "completionPercentage": 20,
  "learningProviderId": "01e8f81b-3060-4dec-acf0-0389665a0a38",
  "dueDateTime": {
    "dateTime": "2022-09-22T16:05:00.0000000",
    "timeZone": "UTC"
  },
  "externalCourseActivityId": "12a2228a-e020-11ec-9d64-0242ac120002",
  "learningContentId": "57baf9dc-e020-11ec-9d64-0242ac120002",
  "learnerUserId": "7ba2228a-e020-11ec-9d64-0242ac120002",
  "notes": {
    "contentType": "text",
    "content": "required assignment added for user"
  },
  "status": "inProgress"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 2: Update a self-initiated learning course activity

Request

The following example shows the request.

PATCH https://graph.microsoft.com/beta/employeeExperience/learningProviders/01e8f81b-3060-4dec-acf0-0389665a0a38/learningCourseActivities/8ba2228a-e020-11ec-9d64-0242ac120003
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.learningSelfInitiatedCourse",
  "completedDateTime": null,
  "completionPercentage": 30,
  "externalCourseActivityId": "12a2228a-e020-11ec-9d64-0242ac120002",
  "learningContentId": "57baf9dc-e020-11ec-9d64-0242ac120002",
  "learningProviderId": "01e8f81b-3060-4dec-acf0-0389665a0a38",
  "startedDateTime": "2021-05-11T22:57:17+00:00",
  "status": "inProgress"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content