// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Message
{
ReceivedDateTime = DateTimeOffset.Parse("2016-10-19T10:37:00Z"),
SentDateTime = DateTimeOffset.Parse("2016-10-19T10:37:00Z"),
HasAttachments = true,
Subject = "subject-value",
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "content-value",
},
BodyPreview = "bodyPreview-value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.MailFolders["{mailFolder-id}"].Messages.PostAsync(requestBody);
重要
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta users mail-folders messages create --user-id {user-id} --mail-folder-id {mailFolder-id} --body '{\
"receivedDateTime": "2016-10-19T10:37:00Z",\
"sentDateTime": "2016-10-19T10:37:00Z",\
"hasAttachments": true,\
"subject": "subject-value",\
"body": {\
"contentType": "",\
"content": "content-value"\
},\
"bodyPreview": "bodyPreview-value"\
}\
'
重要
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Message message = new Message();
OffsetDateTime receivedDateTime = OffsetDateTime.parse("2016-10-19T10:37:00Z");
message.setReceivedDateTime(receivedDateTime);
OffsetDateTime sentDateTime = OffsetDateTime.parse("2016-10-19T10:37:00Z");
message.setSentDateTime(sentDateTime);
message.setHasAttachments(true);
message.setSubject("subject-value");
ItemBody body = new ItemBody();
body.setContentType(BodyType.Text);
body.setContent("content-value");
message.setBody(body);
message.setBodyPreview("bodyPreview-value");
Message result = graphClient.me().mailFolders().byMailFolderId("{mailFolder-id}").messages().post(message);
重要
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Message;
use Microsoft\Graph\Generated\Models\ItemBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Message();
$requestBody->setReceivedDateTime(new \DateTime('2016-10-19T10:37:00Z'));
$requestBody->setSentDateTime(new \DateTime('2016-10-19T10:37:00Z'));
$requestBody->setHasAttachments(true);
$requestBody->setSubject('subject-value');
$body = new ItemBody();
$body->setContentType(new BodyType('text'));
$body->setContent('content-value');
$requestBody->setBody($body);
$requestBody->setBodyPreview('bodyPreview-value');
$result = $graphServiceClient->me()->mailFolders()->byMailFolderId('mailFolder-id')->messages()->post($requestBody)->wait();
重要
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
Import-Module Microsoft.Graph.Beta.Mail
$params = @{
receivedDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z")
sentDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z")
hasAttachments = $true
subject = "subject-value"
body = @{
contentType = ""
content = "content-value"
}
bodyPreview = "bodyPreview-value"
}
# A UPN can also be used as -UserId.
New-MgBetaUserMailFolderMessage -UserId $userId -MailFolderId $mailFolderId -BodyParameter $params
重要
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。
from msgraph import GraphServiceClient
from msgraph.generated.models.message import Message
from msgraph.generated.models.item_body import ItemBody
graph_client = GraphServiceClient(credentials, scopes)
request_body = Message(
received_date_time = "2016-10-19T10:37:00Z",
sent_date_time = "2016-10-19T10:37:00Z",
has_attachments = True,
subject = "subject-value",
body = ItemBody(
content_type = BodyType.Text,
content = "content-value",
),
body_preview = "bodyPreview-value",
)
result = await graph_client.me.mail_folders.by_mail_folder_id('mailFolder-id').messages.post(request_body)
重要
Microsoft Graph SDK では、既定で v1.0 バージョンの API が使用され、ベータ版で使用可能なすべての型、プロパティ、API がサポートされているわけではありません。 SDK を使用してベータ API にアクセスする方法の詳細については、「ベータ API で Microsoft Graph SDK を使用する」を参照してください。