This is the request body I am using to send email to the guests. However, I want to customize the customizedMessageBody using html tags and elements.
{
"invitedUserDisplayName": "Invited User",
"invitedUserEmailAddress": "invited1234#yopmail.com",
"invitedUserMessageInfo": {
"messageLanguage": "string",
"ccRecipients": [
{
"emailAddress": {
"name": "xyz#yopmail.com",
"address": "xyz#yopmail.com"
}
}
],
"customizedMessageBody": "<html>hello tiger</html>"
},
"sendInvitationMessage": true,
"inviteRedirectUrl": "https://myapps.microsoft.com"
}
As Message itself a text area. Due to the Security reason, Customizing the customizedMessageBody using html tags and elements will not be processable.
This document details the available options you have for invitation messages
Related
Why can't the custom payload of the following Web link be displayed under DialogFlow Messenger?
Can you please try with below custom payload. Looks like it's work for me.
{
"richContent": [
[
{
"actionLink": "https://example.com",
"title": "Info item title",
"type": "info"
}
]
]
}
So On clicking on the Info Item Title It's redirect to the specified link.
Let me know if you have any confusion.
Ref: https://cloud.google.com/dialogflow/es/docs/integrations/dialogflow-messenger
In the Graph API explorer, you can send an email with the endpoint
https://graph.microsoft.com/v1.0/me/sendMail
and a basic json payload of
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "user#domain.com"
}
}
],
"from":{
"emailAddress": {
"address": "smtp:my_alias#domain.com"
}
}
}
When I send this request, it still sends the email as user#domain.com instead of my email alias.
I can still see the email alias there when i run the endpoint
https://graph.microsoft.com/beta/me/
Under proxyAddresses
I've looked over the documentation and don't see any clear example of option to send the email as alias.
We can only set from and sender properties to a different value when sending a message from a shared mailbox, for a shared calendar, or as a delegate. See details here (see form and sender) and Setting the from and sender properties. Sending email as alias is not mentioned and cannot work based on the test.
So it's not supported to send the email as alias via Microsoft Graph API.
The value of from and sender must correspond to the actual mailbox used. So the only way to send email as alias is to change alias to primary email in O365 admin center and then send email.
As a workaround, if you just want recipients to think that you are sending from alias, you can configure a delegated mailbox for your mailbox (assign sendAs rights of the mailbox to a delegated user). Delegated mailbox is actually another mailbox and needs to be assigned an Exchange Online license. Then set the from property to the delegated user who have sendAs rights for your mailbox in Microsoft Graph API. See details here. After that, when you send an email, the recipient will see it's from the delegated email.
About how to assign sendAs rights in Exchange Admin Center, please refer to Use the EAC to assign permissions to individual mailboxes. It may take several hours to take effect.
POST https://graph.microsoft.com/beta/me/sendMail
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [{
"emailAddress": {
"address": "user#domain.com"
}
}
],
"from": {
"emailAddress": {
"address": "{delegated mailbox}"
}
}
}
}
Just tested the API and verified working as of now.
https://developer.microsoft.com/en-us/graph/graph-explorer
POST https://graph.microsoft.com/beta/me/sendMail
{
"message": {
"subject": "Meet for lunch test?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "somemail#gmail.com"
}
}
],
"from": {
"emailAddress": {
"address": "myalias#contoso.com"
}
}
}
}
"from" address must be from one of your proxy/alias email addresses.
If you're using AzureAD Tenant/Client IDs to send emails, you can use the sample code below:
var msg = new Message();
msg.Subject = "test";
//... other setup
msg.From = new Recipient {
EmailAddress = new EmailAddress
{ Address = "myalias#contoso.com" }
};
await graphClient.Users["mydefault#contoso.com"].SendMail(msg).Request().PostAsync();
I tried setting msg.Sender and it doesn't work.
How to get the Microsoft SharePoint SiteID using Microsoft Graph API Explorer.
Initially i tried with below API i able to get the Site ID
https://graph.microsoft.com/v1.0/sites/tenantName.sharepoint.com:/sites/TestSite:/drives?select=name,id
Sharepoint URL:
https://tenantName.sharepoint.com/sites/TestSite
I output i got is:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"id": "b!l17-JY9YT67Qp-2TBvsUupBLMUF2SrJHp5VylCDZThT7HpCdF-7uQ6NTp6t-MbR5",
"name": "Documents"
}
]
}
But, when i try with Communication Site
Whose SharePoint URL is:
https://tenantName.sharepoint.com/SitePages/DevHome.aspx
Graph Explorer API
https://graph.microsoft.com/v1.0/sites/tenantName.sharepoint.com:/SitePages/DevHome:/drives?select=name,id
I am getting below error:
{
"error": {
"code": "itemNotFound",
"message": "The provided path does not exist, or does not represent a site",
"innerError": {
"request-id": "8329dfca-c63b-4af5-80b8-75f26be9e2e8",
"date": "2019-10-31T13:18:33"
}
}
}
A sitePage is a fundamentally different resource than a site.
A site is a container that owns any number of sub-sites, apps, lists, document libraries, etc.
A sitePage is just another resource owned by a site.
The sitePage resource is currently only available in the Microsoft Graph Beta version.
So the query for /SitePages/DevHome.aspx would be:
/beta/sites/root/pages/{pageId}
If you don't yet know the correct id for the page, you can filter the SitePage collection based on the page's name:
/beta/sites/root/pages?$filter=name eq 'DevHome.aspx'
This will return a collection with a single entity (the DevHome.aspx page):
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#sites('root')/pages",
"value": [
{
"eTag": "",
"id": "{id}",
"lastModifiedDateTime": "2014-07-10T05:47:29Z",
"name": "DevHome.aspx",
"webUrl": "SitePages/DevHome.aspx",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"displayName": "System Account"
}
},
"parentReference": {
"siteId": "{id}"
},
"contentType": {
"id": "0x0101080062C83F3CFED6744A882F729480DE6C17",
"name": "Wiki Page"
},
"webParts": [],
"publishingState": {
"level": "published",
"versionId": "1.0"
}
}
]
}
I should also point out that you're misinterpreting the result of your first query. When you request /v1.0/sites/{tenant}:/{path}:/drives?select=name,id, you are not getting the IDs for each Site, you're getting the IDs for each Drive within that Site. You can find the objects contained within a site in the Relationships section of the Site Resource documentation
Your Graph API call is incorrect.
Try this one :
https://graph.microsoft.com/v1.0/sites/tenantName.sharepoint.com?select=name,id
I'm trying to use next API method: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessages. Sending messages without attachments works just fine, but I can not understand how to send message with attachments.
According to docs, Message structure can contain array of Attachments with items of type https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesFileAttachment . Problem is in the field ContentBytes -- it is impossible to dump bytes to JSON before sending request to this API method (actually dumping any BLOB to JSON is nonsense).
How should I pass Attachments using REST API at all?
Thanks.
There's an example of passing the attachment on that page: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessageOnTheFly
I know I'm 3 years late but, you can look at this example:
https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#create-and-send-messages (if you don't get forwarded to the section "Create and send messages", please scroll manually).
I know it is 365 and not Microsoft Graph but request is absolutely same.
This is basically how JSON representation of the post method looks:
https://outlook.office.com/api/v2.0/me/sendmail
{
"Message":
{
"Subject": "Meet for lunch?",
"Body": {
"ContentType": "Text",
"Content": "The new cafeteria is open."
},
"ToRecipients": [
{
"EmailAddress": {
"Address": "garthf#a830edad9050849NDA1.onmicrosoft.com"
}
}
],
"Attachments": [
{
"#odata.type": "#Microsoft.OutlookServices.FileAttachment",
"Name": "menu.txt",
"ContentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
]
}
}
update !important: The API has changed a lot, this question shouldn't be taken into consideration anymore
I am trying to use the REST api (via Node.js API) to create cards that the user can respond to and create an interaction in this way.
Reading the docs the creator attribute is not really specified anywhere, so I have no idea how to insert that.
Also this video doesn't help. Nor this guide =)
I believe there is an URL I should set as callback somehow? I'd like to know how to get these responses, please.
update
This is the card I am sending.
{
bundleId: 'veryuniqueBundle',
id: 'veryuniqueBundle:reply',
text: "want to hear moar?",
menuItems: [
{action: "REPLY"}
]
}
that's the response I get:
{
"collection": "timeline",
"itemId": "119c4dc8-c0ce-4a83-aa76-41aab4e8dbe1",
"operation": "INSERT",
"verifyToken": "42",
"userToken": "id:520ef63cde31145deb000001",
"userActions": [
{
"type": "REPLY"
}
]
}
The problem is, I can't see what the user responded (an text) and the reference to the original card id (or bundle) that was responded to. How can I get those
Cards do not provide a direct callback. Instead, when a user selects a menu item it causes the card to be updated with their menu selection. This change subsequently triggers a notification ping to your timeline subscription.
Follow these steps to detect a menu item selection:
Subscribe to notifications for changes in the timeline collection
{
"collection": "timeline",
"userToken": "awesome_kitty",
"verifyToken": "random_hash_to_verify_referer",
}
Insert a timeline card with a custom menu item
{
"text": "Hello world",
"menuItems": [
{
"action": "CUSTOM",
"id": "complete"
"values": [{
"displayName": "Complete",
"iconUrl": "http://example.com/icons/complete.png"
}]
}
]
}
Select the item on Glass
Receive the notification on your subscription URL
{
"collection": "timeline",
"itemId": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg",
"operation": "UPDATE",
"userToken": "harold_penguin",
"userActions": [
{
"type": "CUSTOM",
"payload": "PING"
}
]
}
Do cool stuff in your code
???
Profit