tag:blogger.com,1999:blog-7381090420963911430.post6859839106825978804..comments2023-07-18T11:47:35.064+02:00Comments on Code Ninja: Extraction of term custom properties from list item field of managed metadata typeAnonymoushttp://www.blogger.com/profile/09290719486408235306noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-7381090420963911430.post-33911391976608446112013-09-25T14:07:29.641+02:002013-09-25T14:07:29.641+02:00Thanks a lot for reply ! The method "getTermS...Thanks a lot for reply ! The method "getTermSet" solved my problem. :)<br /><br />My requirement was as below:<br />I am browsing through the list items, if the column is Managed Meta Data I want to see all the value from associated term set.<br /><br />I followed your code blindly yesterday and messed up, so today while debuging I found the simple way to get those values using termSet.Terms collection.<br />Vishal Guravhttps://www.blogger.com/profile/06495590820799010509noreply@blogger.comtag:blogger.com,1999:blog-7381090420963911430.post-36852553113816782152013-09-24T18:04:13.183+02:002013-09-24T18:04:13.183+02:00Where I will get the customProperties?
term.Custo...<i>Where I will get the customProperties?</i><br /><br />term.CustomProperties as described <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.term.customproperties.aspx" rel="nofollow">here</a> is name value collection. <br /><br />Each term can have it's own collection of items accessible by it's names. List customProperties property here should contain list of names of properties for which you would like to get values (because maybe you are only interested in values for property "prop1" and "prop2". <br /><br /><i>Also the term returned by this line of code var term = termSet.GetTerm(termId); have CustomProperties with length zero.</i><br /><br />I would expect that when term was created in term store it did not had assigned any custom properties. That is why in your case this collection is empty. <br /><br />You can use <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.term.setcustomproperty.aspx" rel="nofollow">SetCustomProperty</a> method to assign some custom properties to the term which later on you can retrieve from the list item when term is used there.<br /><br />What is your use case ? Maybe I will be able to help you when I you will explain to me what you are trying to achieve ?Anonymoushttps://www.blogger.com/profile/09290719486408235306noreply@blogger.comtag:blogger.com,1999:blog-7381090420963911430.post-7599813212163712302013-09-24T14:04:32.358+02:002013-09-24T14:04:32.358+02:00Trying to use this code however didn't underst...Trying to use this code however didn't understand this line of code "customProperties.ForEach(x => values.Add(term.CustomProperties[x]));"<br /><br />Where I will get the customProperties?<br /><br />Also the term returned by this line of code "var term = termSet.GetTerm(termId);" have CustomProperties with length zero.<br /><br />Any thought?Vishal Guravhttps://www.blogger.com/profile/06495590820799010509noreply@blogger.com