Although frequently used, attachments have many deal breaking downsides. There simply is:
- No versioning
- No document management
- No search
- No metadata
On documents in attachments. (For a more thorough guide on ‘why you should never use SharePoint lists for storing files and attachments’ visit: https://sharepointmaven.com/why-you-should-never-use-sharepoint-lists-for-storing-files-and-attachments/ )
But is there a way we could connect files from a document library to a list item? Well yes, off course there is.
Solution: Give files an ID
So the easiest way to go about this is to make a reference to the item via ID.
Let’s say we have a list called “Case Study”. In this list is a lot of structured information surrounding a Case:
|Description||This is a case study for Customer X|
Now in this case study you wish to add some extra case files that the client has sent you. Yes, you could add them as an attachment, but we listed the downsides to that already.
You could also add them to a Document Library with an extra column ‘CaseID’. When adding a file you simply give the file the same ID as the accompanying CASE STUDY item.
CASE STUDY LIBRARY:
|Title||Report on Customer x|
You can now filter or search on that ID to show the files surrounding the case study.
Better yet, you can make a detail page (e.g. detail-page.aspx) with a CASE STUDY app-part and a CASE STUDY LIBRARY app-part and a ‘query-string (URL) filter’ to get an ID from the url. So when you go to detail.aspx?CaseID=12 all the correct information is shown. (Note, this only works on the old SP UI)
Now, there is a downside to all this. Namely that you have to manually input the correct CaseID every time you upload a file. Files without a CaseID can’t be related to a CASE STUDY.
If this is a total deal breaker for your organization, there is a way to get around this by starting a SharePoint Designer Workflow to create a document-set with a CaseID every time a CASE STUDY is created. I’ll blog about this solution soon.