Email - Attach Multiple Documents from Content List

  • 24 February 2011
  • 2 replies
  • 1 view

Badge +5

Could anyone shed light on the following please? The process I'm designing needs to send an email containing some SharePoint documents as attachments (the no. of documents and name of the documents will vary for each process). So I’ve used a SP Search event to load the documents into a content field and now I just want to email the documents in this content field as email attachments.


I’ve looked at K2 Documentation, specifically the Email Event Wizard/Attachments(Advanced Mode), which suggests you can drop a content field into the 'Content List' to attach multiple documents. However when I try the wizard won't drop the Content Field in.


The other solution I have looked at is using binary datafields. However, because the no. of documents is not known at design time, my solution needs to be dynamic so that a) the correct no. of datafields are populated and b) the email only contains these 'populated' datafields.


If someone could point me in the right direction with regards c# code to download a document (to a datafield) then I can do point 'a' above.  I haven't got to the bottom of point 'b' though.


And of course if I'm making this more complicated than it should be, please let me know!


 Thank you for any help.


2 replies

Badge +5

Sorted to a fashion. I was advised that this cannot be achieved using the out-of-the-box K2 wizards but rather I would need to amend the attachments code in the mail event's code behind.  However, I've put something together using the wizards which does the job (albeit not slick but possible because I know roughly the number of documents I need to attach*).


Activity 1: SP Search event for my documents (limit return to 5*) , in Server event code do ItemCount of xml items, save the name of the first document.


Activity 2 (looping where LoopCount doesn't exceed ItemCount): SP Doc event to download named document to general binary field, in Server event code copy value of this binary field to binary field named DataFieldName+ LoopCount, increment LoopCount and save next document name in xml.


So I end up with potentially 5* binary fields. Non-slick bit: create 5 separate activities and mail events with the relevant no.of attachments.  The ItemCount determines which activity to go to using line rules.


The ability to attach a list of items from a content field has been logged as a feature request (thanks Nic).

Badge

Hi!


I read this post because I have the same problem with attachments. Could you answer when feature request will be available?


And what kind of field could be used for Content List: in Attachments wizard?

Reply