-1

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?

Pecky
  • 3
  • 1

1 Answers1

0

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

groveale
  • 467
  • 3
  • 11
  • Thank you for your answer. I already created SPFx ListView Command Set extension and will try out your suggestion for creating new draft mail. – Pecky Jan 09 '19 at 13:40