// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ItemPhone
{
DisplayName = "Car Phone",
Number = "+7 499 342 22 13",
};
// 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.Phones.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewItemPhone()
displayName := "Car Phone"
requestBody.SetDisplayName(&displayName)
number := "+7 499 342 22 13"
requestBody.SetNumber(&number)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
phones, err := graphClient.Me().Profile().Phones().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ItemPhone itemPhone = new ItemPhone();
itemPhone.setDisplayName("Car Phone");
itemPhone.setNumber("+7 499 342 22 13");
ItemPhone result = graphClient.me().profile().phones().post(itemPhone);
Import-Module Microsoft.Graph.Beta.People
$params = @{
displayName = "Car Phone"
number = "+7 499 342 22 13"
}
# A UPN can also be used as -UserId.
New-MgBetaUserProfilePhone -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.item_phone import ItemPhone
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ItemPhone(
display_name = "Car Phone",
number = "+7 499 342 22 13",
)
result = await graph_client.me.profile.phones.post(request_body)