Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
Si la solicitud se realiza correctamente, este método devuelve un 204 código de estado sin contenido.
Si se produjo un error al dejar de seguir cualquiera de los sitios especificados, este método devuelve un 207 código de estado y el cuerpo de la respuesta contiene una matriz de entradas que contienen objetos de error y siteIds que indican qué sitios no se pueden dejar de seguir.
Ejemplo:
En el ejemplo siguiente se muestra cómo dejar de seguir varios sitios.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Users.Item.FollowedSites.Remove;
using Microsoft.Graph.Models;
var requestBody = new RemovePostRequestBody
{
Value = new List<Site>
{
new Site
{
Id = "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740",
},
new Site
{
Id = "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,0271110f-634f-4300-a841-3a8a2e851851",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].FollowedSites.Remove.PostAsRemovePostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-sdk-go/users"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphusers.NewRemovePostRequestBody()
site := graphmodels.NewSite()
id := "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740"
site.SetId(&id)
site1 := graphmodels.NewSite()
id := "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,0271110f-634f-4300-a841-3a8a2e851851"
site1.SetId(&id)
value := []graphmodels.Siteable {
site,
site1,
}
requestBody.SetValue(value)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
remove, err := graphClient.Users().ByUserId("user-id").FollowedSites().Remove().PostAsRemovePostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.users.item.followedsites.remove.RemovePostRequestBody removePostRequestBody = new com.microsoft.graph.users.item.followedsites.remove.RemovePostRequestBody();
LinkedList<Site> value = new LinkedList<Site>();
Site site = new Site();
site.setId("contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740");
value.add(site);
Site site1 = new Site();
site1.setId("contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,0271110f-634f-4300-a841-3a8a2e851851");
value.add(site1);
removePostRequestBody.setValue(value);
var result = graphClient.users().byUserId("{user-id}").followedSites().remove().post(removePostRequestBody);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.users.item.followedsites.remove.remove_post_request_body import RemovePostRequestBody
from msgraph.generated.models.site import Site
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RemovePostRequestBody(
value = [
Site(
id = "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740",
),
Site(
id = "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,0271110f-634f-4300-a841-3a8a2e851851",
),
],
)
result = await graph_client.users.by_user_id('user-id').followed_sites.remove.post(request_body)
Si se ejecuta correctamente, devuelve la siguiente respuesta JSON.
HTTP/1.1 204 No Content
Si se produjo un error, devuelve la siguiente respuesta 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": ""
}
}
}
]
}