// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new UserSettings
{
ContributionToContentDiscoveryDisabled = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Settings.PatchAsync(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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewUserSettings()
contributionToContentDiscoveryDisabled := true
requestBody.SetContributionToContentDiscoveryDisabled(&contributionToContentDiscoveryDisabled)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
settings, err := graphClient.Me().Settings().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UserSettings userSettings = new UserSettings();
userSettings.setContributionToContentDiscoveryDisabled(true);
UserSettings result = graphClient.me().settings().patch(userSettings);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\UserSettings;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UserSettings();
$requestBody->setContributionToContentDiscoveryDisabled(true);
$result = $graphServiceClient->me()->settings()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Users
$params = @{
contributionToContentDiscoveryDisabled = $true
}
# A UPN can also be used as -UserId.
Update-MgUserSetting -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.user_settings import UserSettings
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UserSettings(
contribution_to_content_discovery_disabled = True,
)
result = await graph_client.me.settings.patch(request_body)