POST /users/{id|userPrincipalName}/events
POST /users/{id|userPrincipalName}/messages
POST /groups/{id}/events
POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /users/{id|userPrincipalName}/contacts
POST /users/{id|userPrincipalName}/todo/lists/{id}/tasks
POST /users/{id|userPrincipalName}/todo/lists
注:この構文は、サポートされているリソース インスタンスを作成する一般的な方法を示しています。 こうしたリソース インスタンスを作成するために使用できる他の POST 構文すべても、同様の方法でオープン拡張機能を作成できます。
その要求でリソース インスタンスを識別し、機能拡張 ナビゲーション プロパティで POST を行います。
POST /devices/{id}/extensions
POST /users/{id|userPrincipalName}/events/{id}/extensions
POST /groups/{id}/extensions
POST /groups/{id}/events/{id}/extensions
POST /groups/{id}/threads/{id}/posts/{id}/extensions
POST /users/{id|userPrincipalName}/messages/{id}/extensions
POST /organization/{id}/extensions
POST /users/{id|userPrincipalName}/contacts/{id}/extensions
POST /users/{id|userPrincipalName}/extensions
POST /users/{id|userPrincipalName}/todo/lists/{id}/tasks/{id}/extensions
POST /users/{id|userPrincipalName}/todo/lists/{id}/extensions
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Message
{
Subject = "Annual review",
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "You should be proud!",
},
ToRecipients = new List<Recipient>
{
new Recipient
{
EmailAddress = new EmailAddress
{
Address = "rufus@contoso.com",
},
},
},
Extensions = new List<Extension>
{
new OpenTypeExtension
{
OdataType = "microsoft.graph.openTypeExtension",
ExtensionName = "Com.Contoso.Referral",
AdditionalData = new Dictionary<string, object>
{
{
"companyName" , "Wingtip Toys"
},
{
"expirationDate" , "2015-12-30T11:00:00.000Z"
},
{
"dealValue" , 10000
},
},
},
},
};
// 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.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Message message = new Message();
message.setSubject("Annual review");
ItemBody body = new ItemBody();
body.setContentType(BodyType.Html);
body.setContent("You should be proud!");
message.setBody(body);
LinkedList<Recipient> toRecipients = new LinkedList<Recipient>();
Recipient recipient = new Recipient();
EmailAddress emailAddress = new EmailAddress();
emailAddress.setAddress("rufus@contoso.com");
recipient.setEmailAddress(emailAddress);
toRecipients.add(recipient);
message.setToRecipients(toRecipients);
LinkedList<Extension> extensions = new LinkedList<Extension>();
OpenTypeExtension extension = new OpenTypeExtension();
extension.setOdataType("microsoft.graph.openTypeExtension");
extension.setExtensionName("Com.Contoso.Referral");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("companyName", "Wingtip Toys");
additionalData.put("expirationDate", "2015-12-30T11:00:00.000Z");
additionalData.put("dealValue", 10000);
extension.setAdditionalData(additionalData);
extensions.add(extension);
message.setExtensions(extensions);
Message result = graphClient.me().messages().post(message);
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OpenTypeExtension
{
OdataType = "microsoft.graph.openTypeExtension",
ExtensionName = "Com.Contoso.Referral",
AdditionalData = new Dictionary<string, object>
{
{
"companyName" , "Wingtip Toys"
},
{
"dealValue" , 500050
},
{
"expirationDate" , "2015-12-03T10:00:00.000Z"
},
},
};
// 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}"].Extensions.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OpenTypeExtension extension = new OpenTypeExtension();
extension.setOdataType("microsoft.graph.openTypeExtension");
extension.setExtensionName("Com.Contoso.Referral");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("companyName", "Wingtip Toys");
additionalData.put("dealValue", 500050);
additionalData.put("expirationDate", "2015-12-03T10:00:00.000Z");
extension.setAdditionalData(additionalData);
Extension result = graphClient.me().messages().byMessageId("{message-id}").extensions().post(extension);
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OpenTypeExtension
{
OdataType = "microsoft.graph.openTypeExtension",
ExtensionName = "Com.Contoso.Deal",
AdditionalData = new Dictionary<string, object>
{
{
"companyName" , "Alpine Skis"
},
{
"dealValue" , 1010100
},
{
"expirationDate" , "2015-07-03T13:04:00.000Z"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Groups["{group-id}"].Events["{event-id}"].Extensions.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OpenTypeExtension extension = new OpenTypeExtension();
extension.setOdataType("microsoft.graph.openTypeExtension");
extension.setExtensionName("Com.Contoso.Deal");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("companyName", "Alpine Skis");
additionalData.put("dealValue", 1010100);
additionalData.put("expirationDate", "2015-07-03T13:04:00.000Z");
extension.setAdditionalData(additionalData);
Extension result = graphClient.groups().byGroupId("{group-id}").events().byEventId("{event-id}").extensions().post(extension);
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Groups.Item.Threads.Item.Posts.Item.Reply;
using Microsoft.Graph.Models;
var requestBody = new ReplyPostRequestBody
{
Post = new Post
{
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "<html><body><div><div><div><div>When and where? </div></div></div></div></body></html>",
},
Extensions = new List<Extension>
{
new OpenTypeExtension
{
OdataType = "microsoft.graph.openTypeExtension",
ExtensionName = "Com.Contoso.HR",
AdditionalData = new Dictionary<string, object>
{
{
"companyName" , "Contoso"
},
{
"expirationDate" , "2015-07-03T13:04:00.000Z"
},
{
"topPicks" , new List<string>
{
"Employees only",
"Add spouse or guest",
"Add family",
}
},
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Groups["{group-id}"].Threads["{conversationThread-id}"].Posts["{post-id}"].Reply.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc groups threads posts reply post --group-id {group-id} --conversation-thread-id {conversationThread-id} --post-id {post-id}
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.groups.item.threads.item.posts.item.reply.ReplyPostRequestBody replyPostRequestBody = new com.microsoft.graph.groups.item.threads.item.posts.item.reply.ReplyPostRequestBody();
Post post = new Post();
ItemBody body = new ItemBody();
body.setContentType(BodyType.Html);
body.setContent("<html><body><div><div><div><div>When and where? </div></div></div></div></body></html>");
post.setBody(body);
LinkedList<Extension> extensions = new LinkedList<Extension>();
OpenTypeExtension extension = new OpenTypeExtension();
extension.setOdataType("microsoft.graph.openTypeExtension");
extension.setExtensionName("Com.Contoso.HR");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("companyName", "Contoso");
additionalData.put("expirationDate", "2015-07-03T13:04:00.000Z");
LinkedList<String> topPicks = new LinkedList<String>();
topPicks.add("Employees only");
topPicks.add("Add spouse or guest");
topPicks.add("Add family");
additionalData.put("topPicks", topPicks);
extension.setAdditionalData(additionalData);
extensions.add(extension);
post.setExtensions(extensions);
replyPostRequestBody.setPost(post);
graphClient.groups().byGroupId("{group-id}").threads().byConversationThreadId("{conversationThread-id}").posts().byPostId("{post-id}").reply().post(replyPostRequestBody);
次の例では、同じ POST 操作を使用して新しいグループ投稿に拡張機能を作成し、会話を作成します。 POST 操作は、新しい会話、スレッドと投稿、投稿に埋め込まれた新しい拡張情報を作成します。 要求本文には、Topic プロパティと Threads プロパティや、新しい会話の子 post オブジェクトが含まれます。 次いで、その post オブジェクトには、新しい投稿の body と、拡張情報の次のデータが含まれます。
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Conversation
{
Topic = "Does anyone have a second?",
Threads = new List<ConversationThread>
{
new ConversationThread
{
Posts = new List<Post>
{
new Post
{
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "This is urgent!",
},
Extensions = new List<Extension>
{
new OpenTypeExtension
{
OdataType = "microsoft.graph.openTypeExtension",
ExtensionName = "Com.Contoso.Benefits",
AdditionalData = new Dictionary<string, object>
{
{
"companyName" , "Contoso"
},
{
"expirationDate" , "2016-08-03T11:00:00.000Z"
},
{
"topPicks" , new List<string>
{
"Employees only",
"Add spouse or guest",
"Add family",
}
},
},
},
},
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Groups["{group-id}"].Conversations.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Conversation conversation = new Conversation();
conversation.setTopic("Does anyone have a second?");
LinkedList<ConversationThread> threads = new LinkedList<ConversationThread>();
ConversationThread conversationThread = new ConversationThread();
LinkedList<Post> posts = new LinkedList<Post>();
Post post = new Post();
ItemBody body = new ItemBody();
body.setContentType(BodyType.Html);
body.setContent("This is urgent!");
post.setBody(body);
LinkedList<Extension> extensions = new LinkedList<Extension>();
OpenTypeExtension extension = new OpenTypeExtension();
extension.setOdataType("microsoft.graph.openTypeExtension");
extension.setExtensionName("Com.Contoso.Benefits");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("companyName", "Contoso");
additionalData.put("expirationDate", "2016-08-03T11:00:00.000Z");
LinkedList<String> topPicks = new LinkedList<String>();
topPicks.add("Employees only");
topPicks.add("Add spouse or guest");
topPicks.add("Add family");
additionalData.put("topPicks", topPicks);
extension.setAdditionalData(additionalData);
extensions.add(extension);
post.setExtensions(extensions);
posts.add(post);
conversationThread.setPosts(posts);
threads.add(conversationThread);
conversation.setThreads(threads);
Conversation result = graphClient.groups().byGroupId("{group-id}").conversations().post(conversation);