Attaching documents to list items using document templates

%3CLINGO-SUB%20id%3D%22lingo-sub-28420%22%20slang%3D%22en-US%22%3EAttaching%20documents%20to%20list%20items%20using%20document%20templates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-28420%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20got%20a%20list%20with%20attachments%20enabled.%20This%20works%20fine%20for%20adding%20new%20attachments%20to%20the%20list%20item.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20my%20customer%20wants%20to%20add%20documents%20using%20document%20templates.%20These%20templates%20have%20already%20been%20connected%20to%20document%20content%20types%20on%20my%20document%20library.%20So%20with%20the%20following%20html%20I%20can%20open%20word%20and%20applying%20the%20right%20template.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%3CA%20onclick%3D%22%26quot%3BCoreInvoke('createNewDocumentWithRedirect2'%2Cevent%2C'https%3A%5Cu002f%5Cu002fportaldev.mycustomer.com%2FEnterprise%2Fcommercial%5Cu002fShared%22%20documents%3D%22%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fportaldev.mycustomer.com%2FEnterprise%2Fcommercial%2F_layouts%2FCreateNewDocument.aspx%3Fid%3Dhttps%3A%2F%2Fportaldev.mycustomer.com%2FEnterprise%2Fcommercial%2FShared%2520Documents%2FForms%2FNon-Disclosure%2520Agreement%2FMy%3C%2FA%3E%20Template.docx'%2C%20true%2C%201)%3B%20return%20false%3B%22%20href%3D%22%23%22%26gt%3BNew%20NDA%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3BAs%20I'm%20using%20a%203rd%20party%20form%20solution%20anyway%20adding%20the%20above%20link%20is%20easy.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20question%20now%20is%20what%20is%20the%20best%20way%20to%20connect%20the%20document%20to%20my%20list%20item.%20I%20would%20like%20to%20avoid%3A%3C%2FP%3E%3CP%3E1.%20saving%20the%20document%20locally%20and%20then%20attaching%20it%20to%20the%20list%20item.%3C%2FP%3E%3CP%3E2.%20needing%20the%20user%20to%20save%20the%20document%20in%20a%20specific%20location%20with%20a%20specific%20name%20within%20SharePoint%20so%20that%20a%20background%20process%20can%20connect%20things%20up.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20could%20set%20some%20document%20properties%20with%20for%20example%20an%20ID%20of%20the%20item%20then%20that%20would%20be%20ok%2C%20but%20I%20can't%20find%20any%20option%20for%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-28420%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-28441%22%20slang%3D%22en-US%22%3ERe%3A%20Attaching%20documents%20to%20list%20items%20using%20document%20templates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-28441%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1096%22%20target%3D%22_blank%22%3E%40Dean%20Gross%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20tend%20to%20agree%20with%20your%20appraoch.%20The%20reason%20why%20I'm%20going%20for%20the%20list%20appraoch%20is%20that%20I%20need%20to%20user%20submitting%20a%20document%20to%20complete%20a%20form%20with%20metadata.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOf%20course%20I%20coul%20dget%20users%20to%20upload%20a%20document%2C%20then%20get%20them%20to%20select%20edit%20properties%20and%20with%20a%20bit%20of%20luck%20a%20user%20can%20figure%20out%20how%20that%20get%20this%20all%20done.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstead%20of%20the%20above%2C%20I've%20created%20a%20link%20on%20page%20(%20no%20mistake%20possible%20here)%20then%20a%20form%20appears%26nbsp%3B%20with%20all%20the%20fields%20to%20fill%20in%20including%20attachments.%20This%20means%20that%20wihtin%20a%20single%20action%20I%20can%20collect%20all%20the%20information%20and%20document.%20The%20only%20thin%20I%20can't%20handle%20is%20the%20option%20to%20use%20set%20templates%20to%20the%20attachments.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOnce%20the%20fomr%20has%20been%20submitted%20the%20attachment%20is%20copied%20into%20a%20document%20library%20and%20the%20details%20supplied%20on%20the%20list%20item%20form%26nbsp%3Bare%20copied%20to%20the%20document's%20properties%20as%20well.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-28436%22%20slang%3D%22en-US%22%3ERe%3A%20Attaching%20documents%20to%20list%20items%20using%20document%20templates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-28436%22%20slang%3D%22en-US%22%3E%3CP%3EI%20try%20to%20stay%20away%20from%20List%20Attachments%20as%20much%20as%20possible.%20Attachments%20are%20inherently%20difficult%20to%20work%20with%20and%20prevent%20users%20from%20taking%20advantage%20of%20the%20document%20management%2Fcollaboration%20features%20of%20SP.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20these%20docs%20are%20getting%20created%20in%20SP%2C%20i%20would%20create%20them%20in%20a%20doc%20library%2C%20then%20at%20an%20appropriate%20time%2C%20initiate%20a%20workflow%20to%20populate%20a%20list%20and%20add%20a%20link%20from%20the%20List%20to%20the%20document.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20they%20are%20getting%20created%20outside%20of%20SP%2C%20i%20would%20use%20the%20Document%20Organizer%20feature%2C%20upload%20the%20files%20to%20a%20Drop%20Off%20library%2C%20assign%20the%20content%20type%2C%20send%20them%20to%20a%20location%20and%20then%20run%20workflow%20to%20populate%20a%20list%20with%20a%20link%20to%20the%20file.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
MVP

I've got a list with attachments enabled. This works fine for adding new attachments to the list item.

 

Now my customer wants to add documents using document templates. These templates have already been connected to document content types on my document library. So with the following html I can open word and applying the right template.

 

<a onclick="CoreInvoke('createNewDocumentWithRedirect2',event,'https:\u002f\u002fportaldev.mycustomer.com/Enterprise/commercial\u002fShared Documents\u002fForms\u002fNon-Disclosure%20Agreement\u002fMy Template.docx', 'https:\u002f\u002fportaldev.mycustomer.com/Enterprise/commercial\u002fShared Documents\u002fNon-Disclosure Agreement', 'SharePoint.OpenDocuments', false, 'https://portaldev.mycustomer.com/Enterprise/commercial/_layouts/CreateNewDocument.aspx?id=https://po... Template.docx', true, 1); return false;" href="#">New NDA</a>

 

 As I'm using a 3rd party form solution anyway adding the above link is easy. 

 

My question now is what is the best way to connect the document to my list item. I would like to avoid:

1. saving the document locally and then attaching it to the list item.

2. needing the user to save the document in a specific location with a specific name within SharePoint so that a background process can connect things up.

 

If I could set some document properties with for example an ID of the item then that would be ok, but I can't find any option for that.

 

Any ideas?

 

 

 

 

2 Replies
Highlighted

I try to stay away from List Attachments as much as possible. Attachments are inherently difficult to work with and prevent users from taking advantage of the document management/collaboration features of SP.

 

If these docs are getting created in SP, i would create them in a doc library, then at an appropriate time, initiate a workflow to populate a list and add a link from the List to the document.

 

If they are getting created outside of SP, i would use the Document Organizer feature, upload the files to a Drop Off library, assign the content type, send them to a location and then run workflow to populate a list with a link to the file.

Highlighted

Hi @Dean Gross,

 

I would tend to agree with your appraoch. The reason why I'm going for the list appraoch is that I need to user submitting a document to complete a form with metadata.

 

Of course I coul dget users to upload a document, then get them to select edit properties and with a bit of luck a user can figure out how that get this all done.

 

Instead of the above, I've created a link on page ( no mistake possible here) then a form appears  with all the fields to fill in including attachments. This means that wihtin a single action I can collect all the information and document. The only thin I can't handle is the option to use set templates to the attachments.

 

Once the fomr has been submitted the attachment is copied into a document library and the details supplied on the list item form are copied to the document's properties as well.