In this article, I will discuss How to assign automatically metadata column value using document name in SharePoint.
Scenario: “We have 10 images with the file name like ball_back, car_blue etc. Now we want to use metadata column in the library name Icon Type and Icon Colour, also we don’t want the user to do it manually, once a user uploads the image, it should automatically get assigned in metadata column.
Step 1: Create a Picture Library and give it a name “Image Icon Library”, remove every column and keep Title and Thumbnail column for now.
Step 2: Now after creating a library, we need a workflow which will copy the name of the file to the title column.
We will set the column title with the name.
Step3: Now it’s time to strip the title of the file into two different column and for that, we would need two calculated columns.
FilterTitleIcon and FilterTitleIcon2
Title FilterTitleIcon FilterTitleIcon2
Balloon_Red Balloon Red
Create calculated column under library setting, and give it a name FilterTitleIcon.
and use this formula =LEFT(Title,INT(FIND(“_”,Title)-1)) (looking for _ and returning first part of it the title)
Create another Calculated column and give it a name FilterTitleIcon2.
As you can see we have Ballon and Blue separated in two different columns.
Step4: Now we will create two more columns, Icon and Icon Colour column and both would be the choice type.
Also, copy all the icons as icon choices and colors in color choices option in the setting of both the columns respectively, so icon type like Balloon, Tree should be on of the choice for Icon column and Red, Blue would be Icon column.
Step5: Now once we are done with the choice column, we would need workflows to copy the value of filterTitleIcon and filterTitleIcon2 to Icon Type and Icon Color type.
Make sure to check start workflow automatically option if created or changed for all the three workflows.
Step 6: Now to make these choice columns and metadata column, we need to go to Enterprise Metadata and Keywords Settings and select check option.
Step7: Now the last step is to go to Metadata Navigation Settings and add both Icon and Icon Colour Columns and click Ok.
We are done. Now if we go to the library, you can see Metadata Navigation column is showing up in the side navigation and the values are automatically getting assigned to Icon and Icon Colour column.
I hope you enjoy the journey while creating this solution. It took me a while to figure out how to assign value automatically using the file name.
Thanks for visiting my blog and let me know if you need any help in this article. 🙂