May 11 2019 11:05 AM
May 11 2019 11:05 AM
I would like to know how many ways we have to create a managed metadata column in SharePoint? I am reading about it, and I am a bit confused. Some posts I've seen suggest to create the column with XML (note column and metadata column), but then they say there must be a feature receiver to bind this column to the term set.
I am wondering if there's a way to do this with SPFx? or it would be easier to do it with PowerShell?
What are the ways to create the managed metadata column, and what is the recommended way for it?
May 13 2019 06:37 AMSolution
@daniela1995 Personally, I like to use Site Designs + Site Scripts to provision these columns out into environments. And you don't need feature receivers to attach them to term sets. However, there are many ways you can do this.
2. SPFx + Feature Framework (Not my first choice, unless you are deploying columns for a specific spfx solution. https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/provision-sp-assets-from-...
May 13 2019 06:32 PM
@Beau Cameron Thank you for your response.
If you would use SPFx, how would you bind the column to the terms? Since SPFx will still use the feature framework which needs feature receiver (in farm solutions). So how would you do that step?
My requirement is, I have a webpart, that needs to pull some data from 2 lists. One is master, the second will have a lookup column to the first list, plus managed metadata columns to tag these items. So I was thinking I'd have everything in the same solution.
May 15 2019 12:02 PM
@daniela1995 So if you already know the environment it's going into you could update the Elements xml file with the termstore/term groups id. Otherwise, you'll have to do it via code inside the SPFx web part. (Check if it exists, if not, add columns)
May 15 2019 08:13 PM
@Beau Cameron via code inside the SPFx webpart. Does that mean I have to place the webpart somewhere, open it, so the code would get executed and bind the columns, or is there an event receiver when the SPFx webpart is deployed that I can use to write this code? What I want to ask is, where would this code be placed in the spfx webpart?
May 23 2019 06:32 AM
@daniela1995 What I mean by that is, when you add the web part on the page and you open up the web part properties, have the web part property configuration create the list for you (if it doesn't exist). That way, whenever the web part is actually used, it allows the user to select from an already deployed list, or the ability to generate a new one.