POST https://graph.microsoft.com/beta/me/profile/webAccounts
Content-type: application/json
{
"description": "My Github contributions!",
"userId": "innocenty.popov",
"service": {
"name": "GitHub",
"webUrl": "https://github.com"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new WebAccount
{
Description = "My Github contributions!",
UserId = "innocenty.popov",
Service = new ServiceInformation
{
Name = "GitHub",
WebUrl = "https://github.com",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Profile.WebAccounts.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WebAccount webAccount = new WebAccount();
webAccount.setDescription("My Github contributions!");
webAccount.setUserId("innocenty.popov");
ServiceInformation service = new ServiceInformation();
service.setName("GitHub");
service.setWebUrl("https://github.com");
webAccount.setService(service);
WebAccount result = graphClient.me().profile().webAccounts().post(webAccount);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\WebAccount;
use Microsoft\Graph\Generated\Models\ServiceInformation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WebAccount();
$requestBody->setDescription('My Github contributions!');
$requestBody->setUserId('innocenty.popov');
$service = new ServiceInformation();
$service->setName('GitHub');
$service->setWebUrl('https://github.com');
$requestBody->setService($service);
$result = $graphServiceClient->me()->profile()->webAccounts()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.People
$params = @{
description = "My Github contributions!"
userId = "innocenty.popov"
service = @{
name = "GitHub"
webUrl = "https://github.com"
}
}
# A UPN can also be used as -UserId.
New-MgBetaUserProfileWebAccount -UserId $userId -BodyParameter $params