Automatically Create Document Metadata

Introduction to Document Metadata

When it comes Document Metadata Imageto using SharePoint document libraries, one of the most common questions is, “Can I use folders for content organization?” The consistent answer that the SharePoint community seems to be pushing is, “No, do not use folders in SharePoint document libraries.” For the most part, I agree with this statement, but my tune will change depending on who is using the library, how the library will be accessed, and the purpose the document library. What if the end-users do not want to fill-in several columns of metadata each and every time they upload a document? What if the end-users are just getting into SharePoint, have only been dealing with file shares, and have no idea what metadata is? Luckily there is built-in functionality within a document library that will help solve problems for those SharePoint implementers that want metadata columns filled out, and end-users that want their data to live in a folder structure.

Column Default Value Settings

People in general do not like to be told how to do their job. People like to work the way that they like to work, even if you think your way of working is better. Some people prefer to work within Outlook, some people prefer to use their browsers, and some people like use Windows Explorer. The one thing in common amongst all workers is that they do not want to add metadata to files before they can be uploaded. SharePoint’s Column default value settings gives implementers the ability to assign values to columns for each file upon upload without the end-user added any information. In other words, the use of Column default value settings allows the population of pre-defined columns with a default value based off of the document library hierarchy.

Common Issue

As a SharePoint implementer, at one time or another, your end-users have documents that live(d) in a file share. Having documents in a file share is not necessarily a bad thing as it can help determine the metadata columns for the associated documents. In figure 1, looking at the existing file share structure, each document already has theoretical metadata assigned to it based off of where the document lives.

A File ShareFolder Structure

Figure 1: Image of file share folder structure.

If you take a look at the Purchase Orders folders locations, how would you take the file share document structure and move it into SharePoint?

Create the Custom Content Type

To start, since all of the purchase order documents are going to live in a single document library, it would be ideal to create a custom Purchase Order content type.

Create Custom Columns

After the Purchase Order content type has been created, a couple of custom columns will be created to help with sorting and filtering. For this example, two columns will be added to the Purchase Order content type. The first column to create is a “Year” Calculated column. The formula is going to be: TEXT(YEAR([Created]),”000″). The column would look similar to Figure 2:

Year Calculated Column

Figure 2: Creating of the Year Calculated column.

The next column we are going to add, is the Client column, as seen in Figure 3.

Client Column Settings

Figure 3: Client column settings.

Create the Purchase Order Document Library

The next step is to build out the document library, by allowing the management of content types, and adding the Purchase Order content type.
After creating the document library, it is time to build out the appropriate folder structure.

By taking the folder structure from Figure 1, and building it out in SharePoint, the SharePoint document library should look like Figure 4.

Transferring File Share Folders

Figure 4: Example of transferring the file share folder structure into a SharePoint document library.

Setting up Default Values

Now this is where the magic happens. After setting up the document library with the Purchase Order content type, under the library settings, click the Column default value settings, as seen in Figure 5.

Default Value Settings

Figure 5: Document library settings showing the Column default value settings.

Clicking the Column default value settings link will open the ColumnDefaults.aspx page and show the library and folder structure within it, as seen in Figure 6.

The Folder Structure in Purchase Order

Figure 6: Shows the folder structure within the Purchase Order document library.

After selecting (by clicking) the Contoso Purchase Orders folder, click on the Client column. This will open a modal dialog window where you will assign the default value to Contoso, as seen in Figure 7.

The Modal Dialog Window

Figure 7: Shows the modal dialog window for setting the default value for the Contoso folder.

After clicking OK to close the window, notice that there is now a green gear on the Contoso folder. After finishing assigning values to the other folders the ColumnDefauls.aspx page should look like this (figure 8)

Defaut Value for Client Column

Figure 8: Shows the default value for the Client column for items placed in the Contoso folder.

After returning to the Contoso folder within the Purchase Orders document library, drag-and-drop a Purchase Order into the Contoso folder. As seen in Figure 9, my Year and Client metadata has already been filled out automatically.

Year & Client Metadata

Figure 9: Shows the Year and Client metadata automatically populated when a file is added to the Contoso folder.

Having the ability to automatically add metadata will also help with moving the file shares across into SharePoint, as there is no longer a need to update the metadata when the files are added into the appropriate folders. If files are added via OneDrive for Business, the metadata is added as well when the file gets synchronized into SharePoint, as seen in Figures 10 and 11.

Latest Purchase Order

Figure 10: Shows the latest purchase order for Tailspin Toys.

Safe File in SharePoint

Figure 11: Shows the safe file from Figure 10 within SharePoint with metadata already added automatically.

Create Folder-less View

At this point, the last thing to do is to clean up the content by creating a custom view. As discussed in the beginning of this post, most SharePoint professionals do not like folders. Luckily, there is a way to create a view that does not use folders.
Create a view based off the All Documents view and call it Default; check the Make this the default view check box. Under the Folders setting, select the Show all items without folders radial button, and click OK to save the view. This also gives you the ability to group and sort, and return purchase orders for specific years.

Conclusion

When new solutions get rolled out, end-users should be given training. This solution for automatically adding metadata to documents is no exception. Users will need to be aware that for the metadata to automatically be added, the files must be added to the correct folder.
The good news is that after proper training on the solution, users will be able to work the way that they are used to working, such as via a web browser or via Windows Explorer. But the best part is that while the users are happily working away, documents are being added to the document library and metadata is being added automatically without any input from the end-user.

Using Managed Metadata In Custom Solutions

Patrick CurranAbout the Author Patrick Curran:

I am currently the Director for the Federal Group and a SharePoint Architect for Planet Technologies. I have been building solutions with SharePoint since 2003, specializing mostly in complex architecture, administration, branding, and custom development in addition to advanced troubleshooting  I work with clients all over the world to help integrate their organization into SharePoint. I have a very diverse background, and bring a lot of experience and insight into infrastructure and troubleshooting. I have designed and deployed many farms of varying complexity over the years, especially within the Federal realm where nothing is small or simple. I was also fortunate enough to co-author Microsoft® SharePoint® 2013: Designing and Architecting Solutions for Microsoft Press, along with Shannon Bray and Miguel Wood. I also do a lot of hybrid cloud work, mostly between Azure and O365. MCT, MCTS, MCITP, MCPD, MCSA, MCSE

European SharePoint Conference 2015 takes places in Stockholm Sweeden from 9-12 November 2015. View Programme>>

Latest blogs:

Share this on...

Rate this Post:

Share:

Topics:

General