0

Here is my requirement.

I have a custom SharePoint list and Document library. When I add a list item into that custom list it will automatically create a word document in the specified document library with the copy of all the list fields data, then I need to send an email to appropriate person specified in the list item(To field in the custom list) with that document attachment and any list attachments attached in the list item.

I am running on SharePoint server 2013. I Have written SharePoint designer workflow for automatically creates a word document with the copy of all the list data and it is working great. Now I need to send an email with attached document and list attachments to specified person in the list item(To field).

Please help and share your ideas with me ASAP.

1

I dont think you will be able to do this without coding.

So basically what you need to do is:

Custom List : ListA
Library : LibA

  1. Ensure that you can uniquely identify the list item in ListA from the list item in LibA (Take the ID in ListA to a field in LibA)
  2. On the LibA, create an Item event receiver based on ItemAdded
  3. Create a SPList object to ListA
  4. Get the SPListItem you are looking for by calling, list.GetItemByID(fill id in here)
  5. Now look at the item.Attachments property for any list item attachments
  6. Add the attachments to your email
  7. Add the document, generated in the LibA to the email
  8. Add send it to the required user

please see the links below for more info:

Getting Attachments:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/bee6c732-2d2d-49db-af20-ecbfde94cd78/how-to-programmatically-get-attachments-from-a-custom-list

Creating email:
http://edwin.vriethoff.net/2007/10/02/how-to-send-an-e-mail-with-attachment-from-sharepoint/

Kind Regards, JP

  • Thanks for your reply JP. I need to write code for Get list item attachments and get just inserted document from document library in the item added event for document library. Can you please share code with me ASAP. – CherryP Sep 10 '13 at 20:04
0

You can add an event reciever on item adding to the document library. It would be something like this:

  1. Use smtp to create a mail with sender creds, reciever/cc addresses, body and sub. Simple Example Here.

  2. Fetch the stored document in the document library and attach it to the mail. How To here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.