更新 plannerUserUpdate plannerUser

重要

Microsoft Graph 中/beta的版本下的 api 可能会发生更改。APIs under the /beta version in Microsoft Graph are subject to change. 不支持在生产应用程序中使用这些 API。Use of these APIs in production applications is not supported.

更新plannerUser对象的属性。Update the properties of a plannerUser object. 您可以使用此操作在用户的 "收藏夹计划" 列表中添加或删除计划, 并指示用户最近查看过的计划。You can use this operation to add or remove plans from a user's favorite plans list, and to indicate which plans the user has recently viewed.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

权限类型Permission type 权限(从最低特权到最高特权)Permissions (from least to most privileged)
委派(工作或学校帐户)Delegated (work or school account) Group.ReadWrite.AllGroup.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application 不支持。Not supported.

HTTP 请求HTTP request

PATCH /me/planner

可选的请求标头Optional request headers

名称Name 说明Description
AuthorizationAuthorization Bearer {code}。Bearer {code}. 必需。Required.
If-MatchIf-Match 要更新的plannerUser的最新已知 ETag 值。Last known ETag value for the plannerUser to be updated. 必需。Required.

请求正文Request body

在请求正文中,提供应更新的相关字段的值。In the request body, supply the values for relevant fields that should be updated. 请求正文中不包括的现有属性将保留其以前的值,或根据对其他属性值的更改重新计算。Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. 为了获得最佳性能,请勿加入尚未更改的现有值。For best performance, don't include existing values that haven't changed.

属性Property 类型Type 说明Description
favoritePlanReferencesfavoritePlanReferences plannerFavoritePlanReferenceCollectionplannerFavoritePlanReferenceCollection 对集合所做的更改, 其中包含对用户已标记为收藏的计划的引用。Changes to the collection containing the references to the plans that the user has marked as a favorite.
recentPlanReferencesrecentPlanReferences plannerRecentPlanReferenceCollectionplannerRecentPlanReferenceCollection 对集合的更改, 其中包含对用户最近查看过的计划的引用。Changes to the collection containing the references to the plans that the user has recently viewed.

响应Response

如果成功, 此方法在响应200 OK正文中返回响应代码和更新的plannerUser对象。If successful, this method returns a 200 OK response code and an updated plannerUser object in the response body.

此方法可以返回任何 HTTP 状态代码。应用应当为此方法处理的最常见的错误为 400、403、404、409 和 412 响应。有关这些错误的详细信息,请参阅常见规划器错误情况This method can return any of the HTTP status codes. The most common errors that apps should handle for this method are the 400, 403, 404, 409, and 412 responses. For more information about these errors, see Common Planner error conditions.

示例Example

请求Request

下面展示了示例请求。The following is an example of the request. 此请求将 ID 为 "jd8S5gOaFk2S8aWCIAJz42QAAxtD" 的计划 "下一次发布讨论" 添加为用户的收藏夹, 并从 "收藏夹计划" 列表中删除 ID 为 "7oTB5aMIAE2rVo-1N-L7RmQAGX2q" 的计划。This request adds the plan "Next Release Discussion" with ID "jd8S5gOaFk2S8aWCIAJz42QAAxtD" as a favorite for the user, and removes plan with ID "7oTB5aMIAE2rVo-1N-L7RmQAGX2q" from the favorite plans list. 它还更新了计划 "jd8S5gOaFk2S8aWCIAJz42QAAxtD" 的上次查看时间。It also updates the last view time of the plan "jd8S5gOaFk2S8aWCIAJz42QAAxtD".

PATCH https://graph.microsoft.com/beta/me/planner
Content-type: application/json
Content-length: 504
If-Match: W/"JzEtVXNlckRldGFpbHMgQEBAQEBAQEBAQEBAQEBIWCc="

{
  "favoritePlanReferences": {
    "jd8S5gOaFk2S8aWCIAJz42QAAxtD": {
      "@odata.type": "#microsoft.graph.plannerFavoritePlanReference",
      "orderHint": " !",
      "planTitle": "Next Release Discussion"
    },
    "7oTB5aMIAE2rVo-1N-L7RmQAGX2q": null
  },
  "recentPlanReferences": {
    "jd8S5gOaFk2S8aWCIAJz42QAAxtD": {
      "@odata.type": "#microsoft.graph.plannerRecentPlanReference",
      "lastAccessedDateTime": "2018-01-02T22:49:46.155Z",
      "planTitle": "Next Release Discussion"
    }
  }
}
响应Response

下面展示了示例响应。The following is an example of the response.

注意: 为了提高可读性,可能缩短了此处显示的响应对象。所有属性都将通过实际调用返回。Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 979

{
  "favoritePlanReferences": {
    "jd8S5gOaFk2S8aWCIAJz42QAAxtD": {
      "@odata.type": "#microsoft.graph.plannerFavoritePlanReference",
      "orderHint": "8586866870001551087",
      "planTitle": "Next Release Discussion"
    },
    "uZWtCtli30CGoWLIWSat1mQAC0ai": {
      "@odata.type": "#microsoft.graph.plannerFavoritePlanReference",
      "orderHint": "8586888705198093378",
      "planTitle": "Product Support"
    }
  },
  "recentPlanReferences": {
    "jd8S5gOaFk2S8aWCIAJz42QAAxtD": {
      "@odata.type": "#microsoft.graph.plannerRecentPlanReference",
      "lastAccessedDateTime": "2018-01-02T22:49:46.155Z",
      "planTitle": "Next Release Discussion"
    },
    "XYE5pqNJu0uuRC2PM4ZQrmQAF2Pn": {
      "@odata.type": "#microsoft.graph.plannerRecentPlanReference",
      "lastAccessedDateTime": "2018-01-01T19:39:17.57Z",
      "planTitle": "Success Metrics"
    }
  },
  "id": "-YPnMJRiIUSKFyaVjYEkBWQAAc47"
}