POST /me/messages
POST /users/{id|userPrincipalName}/messages
POST /me/mailFolders/{id}/messages
POST /me/mailFolders
POST /users/{id|userPrincipalName}/mailFolders
POST /me/events
POST /users/{id|userPrincipalName}/events
POST /me/calendars
POST /users/{id|userPrincipalName}/calendars
POST /me/contacts
POST /users/{id|userPrincipalName}/contacts
POST /me/contactFolders
POST /users/{id|userPrincipalName}/contactFolders
POST /groups/{id}/events
POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/threads/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/reply
POST /groups/{id}/threads
POST /groups/{id}/conversations
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Event
{
Subject = "Family reunion",
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Let's get together this Thanksgiving!",
},
Start = new DateTimeTimeZone
{
DateTime = "2015-11-26T09:00:00",
TimeZone = "Pacific Standard Time",
},
End = new DateTimeTimeZone
{
DateTime = "2015-11-29T21:00:00",
TimeZone = "Pacific Standard Time",
},
Attendees = new List<Attendee>
{
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "Terrie@contoso.com",
Name = "Terrie Barrera",
},
Type = AttendeeType.Required,
},
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "Lauren@contoso.com",
Name = "Lauren Solis",
},
Type = AttendeeType.Required,
},
},
MultiValueExtendedProperties = new List<MultiValueLegacyExtendedProperty>
{
new MultiValueLegacyExtendedProperty
{
Id = "StringArray {66f5a359-4659-4830-9070-00050ec6ac6e} Name Recreation",
Value = new List<string>
{
"Food",
"Hiking",
"Swimming",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Events.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Event event = new Event();
event.setSubject("Family reunion");
ItemBody body = new ItemBody();
body.setContentType(BodyType.Html);
body.setContent("Let's get together this Thanksgiving!");
event.setBody(body);
DateTimeTimeZone start = new DateTimeTimeZone();
start.setDateTime("2015-11-26T09:00:00");
start.setTimeZone("Pacific Standard Time");
event.setStart(start);
DateTimeTimeZone end = new DateTimeTimeZone();
end.setDateTime("2015-11-29T21:00:00");
end.setTimeZone("Pacific Standard Time");
event.setEnd(end);
LinkedList<Attendee> attendees = new LinkedList<Attendee>();
Attendee attendee = new Attendee();
EmailAddress emailAddress = new EmailAddress();
emailAddress.setAddress("Terrie@contoso.com");
emailAddress.setName("Terrie Barrera");
attendee.setEmailAddress(emailAddress);
attendee.setType(AttendeeType.Required);
attendees.add(attendee);
Attendee attendee1 = new Attendee();
EmailAddress emailAddress1 = new EmailAddress();
emailAddress1.setAddress("Lauren@contoso.com");
emailAddress1.setName("Lauren Solis");
attendee1.setEmailAddress(emailAddress1);
attendee1.setType(AttendeeType.Required);
attendees.add(attendee1);
event.setAttendees(attendees);
LinkedList<MultiValueLegacyExtendedProperty> multiValueExtendedProperties = new LinkedList<MultiValueLegacyExtendedProperty>();
MultiValueLegacyExtendedProperty multiValueLegacyExtendedProperty = new MultiValueLegacyExtendedProperty();
multiValueLegacyExtendedProperty.setId("StringArray {66f5a359-4659-4830-9070-00050ec6ac6e} Name Recreation");
LinkedList<String> value = new LinkedList<String>();
value.add("Food");
value.add("Hiking");
value.add("Swimming");
multiValueLegacyExtendedProperty.setValue(value);
multiValueExtendedProperties.add(multiValueLegacyExtendedProperty);
event.setMultiValueExtendedProperties(multiValueExtendedProperties);
Event result = graphClient.me().events().post(event);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Event;
use Microsoft\Graph\Generated\Models\ItemBody;
use Microsoft\Graph\Generated\Models\BodyType;
use Microsoft\Graph\Generated\Models\DateTimeTimeZone;
use Microsoft\Graph\Generated\Models\Attendee;
use Microsoft\Graph\Generated\Models\EmailAddress;
use Microsoft\Graph\Generated\Models\AttendeeType;
use Microsoft\Graph\Generated\Models\MultiValueLegacyExtendedProperty;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Event();
$requestBody->setSubject('Family reunion');
$body = new ItemBody();
$body->setContentType(new BodyType('hTML'));
$body->setContent('Let\'s get together this Thanksgiving!');
$requestBody->setBody($body);
$start = new DateTimeTimeZone();
$start->setDateTime('2015-11-26T09:00:00');
$start->setTimeZone('Pacific Standard Time');
$requestBody->setStart($start);
$end = new DateTimeTimeZone();
$end->setDateTime('2015-11-29T21:00:00');
$end->setTimeZone('Pacific Standard Time');
$requestBody->setEnd($end);
$attendeesAttendee1 = new Attendee();
$attendeesAttendee1EmailAddress = new EmailAddress();
$attendeesAttendee1EmailAddress->setAddress('Terrie@contoso.com');
$attendeesAttendee1EmailAddress->setName('Terrie Barrera');
$attendeesAttendee1->setEmailAddress($attendeesAttendee1EmailAddress);
$attendeesAttendee1->setType(new AttendeeType('required'));
$attendeesArray []= $attendeesAttendee1;
$attendeesAttendee2 = new Attendee();
$attendeesAttendee2EmailAddress = new EmailAddress();
$attendeesAttendee2EmailAddress->setAddress('Lauren@contoso.com');
$attendeesAttendee2EmailAddress->setName('Lauren Solis');
$attendeesAttendee2->setEmailAddress($attendeesAttendee2EmailAddress);
$attendeesAttendee2->setType(new AttendeeType('required'));
$attendeesArray []= $attendeesAttendee2;
$requestBody->setAttendees($attendeesArray);
$multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1 = new MultiValueLegacyExtendedProperty();
$multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1->setId('StringArray {66f5a359-4659-4830-9070-00050ec6ac6e} Name Recreation');
$multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1->setValue(['Food', 'Hiking', 'Swimming', ]);
$multiValueExtendedPropertiesArray []= $multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1;
$requestBody->setMultiValueExtendedProperties($multiValueExtendedPropertiesArray);
$result = $graphServiceClient->me()->events()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.event import Event
from msgraph.generated.models.item_body import ItemBody
from msgraph.generated.models.body_type import BodyType
from msgraph.generated.models.date_time_time_zone import DateTimeTimeZone
from msgraph.generated.models.attendee import Attendee
from msgraph.generated.models.email_address import EmailAddress
from msgraph.generated.models.attendee_type import AttendeeType
from msgraph.generated.models.multi_value_legacy_extended_property import MultiValueLegacyExtendedProperty
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Event(
subject = "Family reunion",
body = ItemBody(
content_type = BodyType.Html,
content = "Let's get together this Thanksgiving!",
),
start = DateTimeTimeZone(
date_time = "2015-11-26T09:00:00",
time_zone = "Pacific Standard Time",
),
end = DateTimeTimeZone(
date_time = "2015-11-29T21:00:00",
time_zone = "Pacific Standard Time",
),
attendees = [
Attendee(
email_address = EmailAddress(
address = "Terrie@contoso.com",
name = "Terrie Barrera",
),
type = AttendeeType.Required,
),
Attendee(
email_address = EmailAddress(
address = "Lauren@contoso.com",
name = "Lauren Solis",
),
type = AttendeeType.Required,
),
],
multi_value_extended_properties = [
MultiValueLegacyExtendedProperty(
id = "StringArray {66f5a359-4659-4830-9070-00050ec6ac6e} Name Recreation",
value = [
"Food",
"Hiking",
"Swimming",
],
),
],
)
result = await graph_client.me.events.post(request_body)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Message
{
MultiValueExtendedProperties = new List<MultiValueLegacyExtendedProperty>
{
new MultiValueLegacyExtendedProperty
{
Id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name Palette",
Value = new List<string>
{
"Green",
"Aqua",
"Blue",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Messages["{message-id}"].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.NewMessage()
multiValueLegacyExtendedProperty := graphmodels.NewMultiValueLegacyExtendedProperty()
id := "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name Palette"
multiValueLegacyExtendedProperty.SetId(&id)
value := []string {
"Green",
"Aqua",
"Blue",
}
multiValueLegacyExtendedProperty.SetValue(value)
multiValueExtendedProperties := []graphmodels.MultiValueLegacyExtendedPropertyable {
multiValueLegacyExtendedProperty,
}
requestBody.SetMultiValueExtendedProperties(multiValueExtendedProperties)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
messages, err := graphClient.Me().Messages().ByMessageId("message-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Message message = new Message();
LinkedList<MultiValueLegacyExtendedProperty> multiValueExtendedProperties = new LinkedList<MultiValueLegacyExtendedProperty>();
MultiValueLegacyExtendedProperty multiValueLegacyExtendedProperty = new MultiValueLegacyExtendedProperty();
multiValueLegacyExtendedProperty.setId("StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name Palette");
LinkedList<String> value = new LinkedList<String>();
value.add("Green");
value.add("Aqua");
value.add("Blue");
multiValueLegacyExtendedProperty.setValue(value);
multiValueExtendedProperties.add(multiValueLegacyExtendedProperty);
message.setMultiValueExtendedProperties(multiValueExtendedProperties);
Message result = graphClient.me().messages().byMessageId("{message-id}").patch(message);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Message;
use Microsoft\Graph\Generated\Models\MultiValueLegacyExtendedProperty;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Message();
$multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1 = new MultiValueLegacyExtendedProperty();
$multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1->setId('StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name Palette');
$multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1->setValue(['Green', 'Aqua', 'Blue', ]);
$multiValueExtendedPropertiesArray []= $multiValueExtendedPropertiesMultiValueLegacyExtendedProperty1;
$requestBody->setMultiValueExtendedProperties($multiValueExtendedPropertiesArray);
$result = $graphServiceClient->me()->messages()->byMessageId('message-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Mail
$params = @{
multiValueExtendedProperties = @(
@{
id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name Palette"
value = @(
"Green"
"Aqua"
"Blue"
)
}
)
}
# A UPN can also be used as -UserId.
Update-MgUserMessage -UserId $userId -MessageId $messageId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.message import Message
from msgraph.generated.models.multi_value_legacy_extended_property import MultiValueLegacyExtendedProperty
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Message(
multi_value_extended_properties = [
MultiValueLegacyExtendedProperty(
id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name Palette",
value = [
"Green",
"Aqua",
"Blue",
],
),
],
)
result = await graph_client.me.messages.by_message_id('message-id').patch(request_body)