Add Recipients on a Thread or Conversations - outlook

I'm trying to add Recipients to a Conversations or a thread without sending them a message which happens when I add them to the attribute newRecipients
"newRecipients": [{"emailAddress": {
"name": "name-value",
"address": "address-value"
}}]
Anyone that could give me some guidance. The move Operation for a mail isn't available to use outside the outlook web app which makes it hard to copy a mail to an Office365 group.
Would appreciate all the help I could get. This is for an outlook add-in.

Related

Outlook API, Message Moved to "Sent Items" still beign marked as "[Draft]"

I'm working on an Outlook Add-in, using office.js, where users can send secure emails using backend service.
In compose mode, when the user sends the email, using the add-in of course, the add-in will then move the message to "Sent Items" folder using the Outlook API /message/{id}/move and everything goes OK with the exception that the message in question still being marked as "Draft" by Outlook which is really annoying and does confuse the user who just sent the email by telling him that "this message hasn't been sent"
I searched through the API to see if there is a way to mark an email as "SENT" in order to prevent Outlook from showing this RED hint but with no luck so far!
So, My Question Is: Is there any way to overcome this misleading msg by marking the email as it was sent by Outlook?
Thanks in advance.
Finally, I was able to achieve a perfect solution for this challenge.
Based on:
#BrianClink's comment
This answer (Which uses Graph API but Outlook REST API): Microsoft Graph API mail office 365: Is any option create inbox message NOT as Draft?
The approach/steps I followed to mark a mailItem as "SENT" (and not shown as 'draft') and put it in "SentItems" Folder are as follow:
First, Save the mailItem as "draft" using Office.context.mailbox.item.currentMail.saveAsync then retrieve its ID
Clone this draft mailItem properties eg: 'Sender', 'Subject', 'Body', 'ToRecipients'..etc so you get an exact copy of it.
With the newly cloned mailItem, add '[SingleValueExtendedProperties]' property with this value :
[
{
PropertyId: 'Integer 0x0E07',
Value: '1'
}
];
Serialize the new item as JSON and POST it to "sentitems" folder as follows:
xhr.open('POST', restHost + '/v2.0/me/MailFolders/sentitems/messages/');
xhr.send(clonedEmailJson);
On success, with xhr.status=201 [created], Remove the draft mailitem using a [DELETE] request
And you will end up having a new mail item created in your "sentItems" folder which appears as it was sent by Outlook :)
This was a very helpful solution to me because my users are using my add-in to send secure emails (using 3rd party API) and NOT Outlook, So, I wanted them to have the same UX/feeling as when they use Outlook.
Note:
Although the solution worked for me perfectly, it came with a price!
On slow internet connections or in case emails containing large attachments, the process can be remarkably slow, because the addin will first save the draft to the remote Exchange Server, get its ID, then duplicate it and send it again to the server, then remove the draft-ed one.

Send Attachments to Bot in Teams

I'm working with BotBuilder in .NET C#.
I can't figure out how I can send an attachment to the bot using Teams client - I've tried using the Windows desktop app and the web client but neither shows an attachment button in a chat with the bot.
I also tried with the Android client and found that I could send image attachments but not other file types, which I then went back and found that I could do the same in desktop/web clients by pasting the image into the chat box.
Using this method I do get an item in Activity.Attachments with ContentType="image/*". Any other type of file that I try to attach in the Android client is not sent to the bot (nothing in the Activity.Attachments collection) and as I said the other clients won't allow me to even attach anything in 1:1 chat.
Attaching a file in a Teams Channel adds the file to the Channel but I don't get any reference to the attachment if I #mention the bot along with the attachment.
The only mention of consuming attachments in bot sent via Teams I can find is here where it's stated that you'll need to use a JwtToken to access the file. I'm guessing this is currently a limitation in Teams as I'm able to send/receive attachments from other channels, but I'd like to confirm that there isn't some nuance that I'm missing.
Currently, Microsoft Teams does not support the ability to send non-image files to bots.
We are currently working on delivering this feature, but we do not yet have an ETA.
Image attachment can be send through Teams by copy pasting them in the Chat window.Teams have pushed the new Build where you can have Attachment Functionality available in Chat BOT. Now you can attach any file in the teams channel but you need to continue to send the Jwt token.
You can explore the type FileDownloadInfo which can be used to know the file type, content and other required details after you send the attachment to the BOT.
To answer your first question. Microsoft Teams does not show "attachment" button by default. You can install "App Studio" in Teams, and create an app for your bot, specify your app allows upload attachments. And install it in your own Team account for testing.
The second question, you can't get the image attachment. The JSON from Microsoft Teams channel is different from other channels.
You may notice the "contentType" is different, and the "contentUrl" requires a login in order to download the image. You need to use "content.downloadUrl" instead.
"attachments": [
{
"contentType": "application/vnd.microsoft.teams.file.download.info",
"contentUrl": "https://xxx-xxx.sharepoint.com/personal/xxxx/Documents/Microsoft Teams Chat Files/Cloud section in Singapore.PNG",
"content": {
"downloadUrl": "https://xxxx-xx.sharepoint.com/personal/xxxx/_layouts/15/download.aspx?UniqueId=a3cf2177-1cc7-433b-8344-129140c0694e&Translate=false&tempauth=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvc2FnZTM2NS1teS5zaGFyZXBvaW50LmNvbUAzZTMyZGQ3Yy00MWY2LTQ5MmQtYTFhMy1jNThlYjAyY2Y0ZjgiLCJpc3MiOiIwMDAwMDAwMy0wMDAwLTxxxxx&ApiVersion=2.0",
"uniqueId": "xxxx-1cc7-433b-8344-xxxxxx",
"fileType": "png"
},
"name": "Cloud section in Singapore.PNG",
"thumbnailUrl": null
}
]

Delay emails sent and received through IMAP

I want to put emails the user receives in a sort of "review status" in my app and let users choose manually if they want them to be let through.
For this I need to filter network traffic to withhold emails receivef with the IMAP protocol from Outlook and send them some time afterward. And to the same for emails being sent.
Would this be possible to do on Outlook on Windows 7/8? Or would I be unable to make Outlook receive the mailing after I filter it out?
The Outlook object model doesn't provide anything for foltering emails.
Instead, you may consider handling the new email programmatically in the code handling the NewMailEx event which is fired when a new item is received in the Inbox. For example, you may develop a VBA macro for doing any customizations in Outlook programmatically. See Getting Started with VBA in Outlook 2010 for more information.

Exchange 2010, find out if email is meeting invite without loading attachment

I have a mail sniffer program running on an Inbox in Exchange Server 2010 that checks emails at certain intervals. I would like to know if it somehow is possible to programmatically check with EWS (Exchange Web Services) if an email (EmailMessage) is a meeting invite (calendar request) without loading the attachment.
I know I can check if an attachment is an Microsoft.Exchange.WebServices.Data.ItemAttachment and then, after loading the email check if this is an Microsoft.Exchange.WebServices.Data.Appointment. But this only checks if the attachment is an invite. Theoretically someone could forward an email with amongst other thing an email invite. Then the email is really not a meeting invite, just a forwarded email.
Can you know if an email is a meeting invite without loading the attachment? Should this not be possible with EWS, is there an authorative source for this?
Edit: Forwarded emails
This is outside the question, but I originally asked:
Alternatively (but not what I am hoping for), is there a way to know
if an email was forwarded so that I can handle them differently?
This has been answered here. But I still would like to get an answer for my question as this answer only helps creating a workaround for some cases.
Thanks in advance!
You can leverage the EmailMessage Message Class ItemSchema.ItemClass property to determine what type an item is. Here is a snippet to help you out...
FindItemsResults<Item> mailItems = inbox.FindItems(new ItemView(1000) { PropertySet = new PropertySet(ItemSchema.Id, ItemSchema.HasAttachments, ItemSchema.Subject, ItemSchema.ItemClass) });
foreach (EmailMessage message in messageItems)
{
if (message.ItemClass == "IPM.Schedule.Meeting.Request")
// we have a meeting request
}

Send Outlook Calendar event to group, and prevent each member from seeing other members emails

I am trying to send a unique calendar event to each member of a group/distribution list in Outlook. I can cc all members but that will reveal all email address to each member in the group. Does anyone know the correct way to do this.
Any help is deeply appreciated.
I can think of using BCC'ing invitees is to forward the meeting as an iCal. Add the attendees to the message BCC field and give a try.
Using Outlook or any messaging api's, the above is not possible, because meeting requests don't use a "Bcc" field. The equivalent of that field is reserved for inviting resources.

Resources