Spfx for creating new draft email with attachment - sharepoint

I need to create spfx button that will upload selected library item/document to new draft email as an attachment. I assume this needs to be done via Ms Graph API (pnp msgraph). Does anybody have samples or suggestions on how can this be done?

Regarding the SPFx button, you will need to create and SPFx ListView Command Set extension. This will enable you to add a button directly into the document library command bar.
This guide should help you with that.
Creating the draft email is a little harder. There are many solutions that you can use to send the mail. The Send Mail MSGraph action is one way.
However, a solution could be to build and launch a mailto: link in your SPFx extension that contains the URL to the selected file in the message body. Not quite an attachment but this would create the draft email and open it in the users email client.
Hopefully this helps get you started

Related

Display email draft and send in Outlook on Button Click in Angular/NodeJs

I have a requirement wherein on click of button on a dialog, I want an email draft that will popup in Outlook so that any message can be customized before sharing the same.
This is to be integrated in Angular/Nodejs Application.
I assume below possibilities on same.
1.Using Angular to display emailsIds to which mail would be sent
2.On click of "send Email" button,there would be a nodeJs service call that would open Outlook with prepopulated emailIds selected from first screen and using node-outlook library setup up outlook call.
https://www.npmjs.com/package/node-outlook
Please suggest if any better approach possible for same and also if anyone has worked on such requirement a working demo code would be very helpful to build this on.
You could probably use window.open and mailTo protocol to open the email draft at client end.
window.open('mailto:abc#gmail.com;xyz#gmail.com?cc=pqr#gmail.com&subject=Subject&body=Hello World', '_self');
All Details required to be displayed on the mail could be fetched through node service calls.

Add attachement to email

I have a request to create a Get support button in an application.
The button will have to open the Lotus Notes application(which is installed in a generic fixed location), to auto-complete the e-mail to, subject, body of the e-mail and also, the most important part, to add an attachement to the e-mail.
I managed to open the Lotus Notes with the fields completed with the command:
mailto:support_adress#domain.com?subject=First%20Email%20&body=this is the body
The problem is with the attachement. Due to security concerns, mailto doesn't support attachements.
So the question is, can I do it with an Lotus Notes Script( which can be executed from my application)?
If yes, can anyone guide me to some usefull informations or examples to start learning to create a script which would do it?
Yes, you can do it with LotusScript:
get user's mail database
create a new document in backend
add fields "SendTo" and "Subject"
create RichText field "Body" and attach file to it
open document in UI

How do I send an email directly from a gmail add on?

I have developed a gmail add-on for personal use and it can currently draft a reply to a recipient using message.createDraftReply(replyMessage);. I then have to manually send email.
After the button click event, I would rather that the the email just be sent directly without further action needed on my end and the UI go back to the inbox (rather than the email view).
Is this possible? If so, can you please provide some direction/example.
Have you tried using the sendEmail method?
See documentation here:
https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String,Object)

Add custom text to Sharepoint Email Alert

We have an alert set-up for sharepoint list, but I want to add some custom text to the alert email. We do not have any access to SPD or sharepoint server and can make changes to sharepoint client only.
Can anyone please advice?
The code that sends out emails runs on the SharePoint server via the Timer Job. Since you have no access to do anything with the server you've got absolutely no chance of modifying the built in alert emails.
Could you do this with javascript?
You can't send emails with JavaScript directly. You can open up a draft email in a users default email client using a mailto link but this won't achieve what you want as a user will still have to edit it.
You could, I suppose, put some javascript onto an edit page using a content editor web part (which you can do without SPD) to on changes make an AJAX call to a separate web server to do the actual sending.

Approve/Reject in email generated by SharePoint

When I make a meeting in Outlook, the recipient gets a approve/reject button in the top of the email. I'd like to do a similar thing with SharePoint: when a task is created, an email is sent to the person the task is assigned to, and the email asks the recipient to either accept or reject the task. I've seen demos of people doing this with a custom ASPx page, but I'd like to make it directly in the email. How should I go about doing that?
I'm used to making workflows in Visual Studio, so I'm happy with code examples for setting up an email and/or parsing the response
Cheers
Nik
The approve/reject buttons in Outlook shows up because the email is in the iCalendar format. I dont know if this is the best way, but you can send out your own iCalendar emails using C# code and set the response email to a mail server you control. From that mail server you can process the email and use the SharePoint WebService API to approve the item in SharePoint.
I like JMD's suggestion but I don't know how you'd interact with SharePoint from the mail server.
It might be a easier to send an HTML-formatted email with two links (...) for the Accept and Reject buttons. You could use CSS to format them so that they look like real buttons.
You could then create an ASPX page (or better an IHttpHandler implementation) to perform an action based on parameters passed to it via a URL. You'd want to pass in the site, web and list details and the list item ID along with a value to indicate whether the item is approved or rejected.
Then set the URLs of your "buttons" in the email to call your handler and pass in the appropriate parameter values.
The downside to this is that the "buttons" would be part of the message body and not part of the Outlook chrome but, on the other hand, they would be usable from any email client.

Resources