I use the following sample to sent a simple email.
https://learn.microsoft.com/en-us/xamarin/essentials/email?tabs=android
The first time when I run xamarin forms app and call the sent method the popup with apps for selection appeared.
I selected Viber for testing, nothing happened but now i can't undo this selection. Every time when i call the send mail the viber opened.
I tried to clear the app data from the settings and unistall-install the app again but i have the same problem.
How can i fix it ? Can i open a dialog with only email clients ?
Thanks !!
I replace Xamarin.Essential email implementation
var message = new EmailMessage
{
Subject = subject,
Body = body,
To = recipients
};
await Email.ComposeAsync(message);
with
Device.OpenUri(new Uri("mailto:test#test.com?subject=test&body=test"));
Now the dialog has only the available mail clients.
Related
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.
I'm currently building an integration with Office 365 Outlook thanks to the Microsoft Graph API. I retrieve user messages data, along with the webLink, which is a direct URL to the message in Outlook Web App.
By default, it opens in a popout window displaying only this message. My goal is to display it in the full Outlook Web App. In the documentation of a Message resource, Microsoft states this:
You can append an ispopout argument to the end of the URL to change how the message is displayed. If ispopout is not present or if it is set to 1, then the message is shown in a popout window. If ispopout is set to 0, then the browser will show the message in the Outlook Web App review pane.
Doing this works well if the e-mail is in the Inbox mail folder. However, if it is in another folder (like Sent Items or a custom one), it always redirects to the Inbox and opens the first message in it.
Is it a known limitation of this parameter? Is there a workaround to achieve this?
Best regards!
I am trying to build a bot that can address the requests placed by the user. However, the bot needs to ask permission of the user's manager for the same. So this is the flow:
User places a request to the bot.
Bot informs user's manager to either approve or reject the request
Based on the response from manager, bot either address the request or does not and informs the user.
I am able to make a 1:1 conversation between bot and user using the PromptDialog, and perform steps 1 and 3. However, I am not sure how to send message to another user for approval or rejection and continue the earlier conversation with the first user. I am using C# for this bot. Any ideas on how could I do this?
Thanks
Niyati
After sending the message to a second user using the following code and storing in the inbox of the first user, you can send the stored result, again using the above code, to the first user and follow their conversations.
string recipientId ="123456789"; // For Example
string serviceUrl = "https://telegram.botframework.com"; // For Example
var connector = new ConnectorClient(new Uri(serviceUrl));
IMessageActivity newMessage = Activity.CreateMessageActivity();
newMessage.Type = ActivityTypes.Message;
newMessage.From = new ChannelAccount("<BotId>", "<BotName>");
newMessage.Conversation = new ConversationAccount(false, recipientId);
newMessage.Recipient = new ChannelAccount(recipientId);
newMessage.Text = "<MessageText>";
await connector.Conversations.SendToConversationAsync((Activity)newMessage);
The code comes from here.
check this page, specifically the start conversation section.
You could keep a context stack for each user, pushing an item on top of the stack for each message sent by the bot and matching context in FIFO order for each message recieved. Now this context stack goes into a map identified by the userId/userKey.
Bot-context is a library which does exactly this. The related blog post.
I have an Exchange Web Services component that someone wrote a few years ago and has been working un-maintained since then, until an issue arose yesterday.
We have one specific email being sent from an external contractors system to our mailboxes. It is a HTML formatted email, but when I try the following:
EmailMessage em = item as EmailMessage
ExtendedPropertyDefinition htmlBody = new ExtendedPropertyDefinition(0x1013, MapiPropertyType.Binary); //PR_BODY_HTML=0x1013 ?)
em.TryGetProperty(htmlBody, out bodyHTMLBytes);
I get am getting a null response just for these specific emails. All other HTML-based emails are coming through just fine.
Are there any other ways we could be looking for a HTML body? The email renders just fine in Outlook and OWA.
Maybe is a report item (delivery, non-delivery, receipt etc)? These do not have bodies (the body is composed "on the fly" by Outlook from RTF internal message data).
For example here:
http://msdn.microsoft.com/en-us/library/ff769550(VS.92).asp
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.To = "user#example.com";
emailComposeTask.Body = "Email message body";
emailComposeTask.Cc = "user2#example.com";
emailComposeTask.Subject = "Email subject";
emailComposeTask.Show();
I read it doesnt work yet.
I have a real device, and an application in the marketplace - it is definitely working. The reason it doesn't work on an emulator is that you can't set up an email account on the emulator, and the first step of the email compose task when it is run is to prompt the user to select which email account to send the email with (if you've got more than one)
Since you can't set one up on the emulator, it kicks back and you can't send an email.
The only way to test this (for now) is to debug on an actual WP7 device, but I can 100% guarantee this is working.
One thing to note about the email tasker is that you can't programmatically add attachments...yet.
Yes, it works on real devices (not on the emulator)
Just pasted your code into an app, deployed to a device and was presented with a choice of which of my email accounts I wanted to use for the email after which the email was prepared ready editing and sending.