POST https://graph.microsoft.com/beta/me/profile/anniversaries
Content-type: application/json
{
"type": "birthday",
"date": "1980-01-08"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new PersonAnnualEvent
{
Type = PersonAnnualEventType.Birthday,
Date = new Date(DateTime.Parse("1980-01-08")),
};
// 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.Anniversaries.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.NewPersonAnnualEvent()
type := graphmodels.BIRTHDAY_PERSONANNUALEVENTTYPE
requestBody.SetType(&type)
date := 1980-01-08
requestBody.SetDate(&date)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
anniversaries, err := graphClient.Me().Profile().Anniversaries().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PersonAnnualEvent personAnnualEvent = new PersonAnnualEvent();
personAnnualEvent.setType(PersonAnnualEventType.Birthday);
LocalDate date = LocalDate.parse("1980-01-08");
personAnnualEvent.setDate(date);
PersonAnnualEvent result = graphClient.me().profile().anniversaries().post(personAnnualEvent);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\PersonAnnualEvent;
use Microsoft\Graph\Beta\Generated\Models\PersonAnnualEventType;
use Microsoft\Kiota\Abstractions\Types\Date;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PersonAnnualEvent();
$requestBody->setType(new PersonAnnualEventType('birthday'));
$requestBody->setDate(new Date('1980-01-08'));
$result = $graphServiceClient->me()->profile()->anniversaries()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.People
$params = @{
type = "birthday"
date = "1980-01-08"
}
# A UPN can also be used as -UserId.
New-MgBetaUserProfileAnniversary -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.person_annual_event import PersonAnnualEvent
from msgraph_beta.generated.models.person_annual_event_type import PersonAnnualEventType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PersonAnnualEvent(
type = PersonAnnualEventType.Birthday,
date = "1980-01-08",
)
result = await graph_client.me.profile.anniversaries.post(request_body)