取消关注网站

命名空间:microsoft.graph

重要

Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

取消关注 用户网站或多个 网站。

权限

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限

权限类型 权限(从最低特权到最高特权)
委派(工作或学校帐户) Sites.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。
应用程序 Sites.ReadWrite.All

HTTP 请求

POST /users/{user-id}/followedSites/remove

请求正文

在请求正文中,提供 JSON 对象数组以及下表中提到的 id 参数。

名称 说明
id string 项的唯一标识符

响应

  • 如果请求成功,此方法返回无 204 内容的状态代码。
  • 207如果在取消关注任何指定网站时发生错误,此方法将返回状态代码,响应正文将包含一组包含 error 对象和 siteId 的条目,这些条目指示哪些网站无法取消处理。

示例

以下示例演示如何取消关注多个网站。

请求

POST /users/{user-id}/followedSites/remove
Content-Type: application/json

{
    "value":
    [
        {
            "id": "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740"
        },
        {
            "id": "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,0271110f-634f-4300-a841-3a8a2e851851"
        }
    ] 
}

响应

如果成功,它将返回以下 JSON 响应。

HTTP/1.1 204 No Content

如果发生错误,它将返回以下 JSON 响应

HTTP/1.1 207 Multi-Status
Content-type: application/json

{
    "value": [
        {
            "id": "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,512a596e-90a1-49e3-9b48-bfa80bee8740",
            "error": {
                "@odata.type": "#oneDrive.error",
                "code": "invalidRequest",
                "message": "The site Id information that is provided in the request is incorrect",
                "innerError": {
                    "code": "invalidRequest",
                    "errorType": "expected",
                    "message": "The site Id information that is provided in the request is incorrect",
                    "stackTrace": "",
                    "throwSite": ""
                }
            }
        }
    ]
}