Hot answers tagged

7

I have blogged about it here: http://www.vrdmn.com/2012/12/working-with-taxonomy-and-javascript-in.html The code: $(document).ready(function(){ var scriptbase = _spPageContextInfo.webServerRelativeUrl + "_layouts/15/"; $.getScript(scriptbase + "SP.Runtime.js", function () { $.getScript(scriptbase + "SP.js", function(){ ...


3

Write code as below: string url = " http://sitecollection/page.aspx>k=hr"; string title = "HR"; SPNavigationNodeCollection quickLaunch = web.Navigation.QuickLaunch; SPNavigationNode newnode = new SPNavigationNode(title, url, true); web.Navigation.QuickLaunch.AddAsLast(newnode); or another method is: var newNode = new SPNavigationNode("HR", "http://...


3

I have been looking for the answer to this one too. The following should retrieve the extra properties: //paste code on one line context.load(tsTerms, 'Include(IsRoot, Labels, TermsCount, CustomSortOrder, Id, IsAvailableForTagging, Name, PathOfTerm, Parent, TermSet.Name)'); The following blog had some good examples that have helped me get my code working. ...


2

I have added a input button with ID btnTaxonomies, which is fetching the Terms from the Terms store using JSOM $(document).ready(function () { $('#btnTaxonomies').click(function () { SP.SOD.registerSod('sp.taxonomy.js', SP.Utilities.Utility.getLayoutsPageUrl('sp.taxonomy.js')); $('#btnTaxonomies').val("Getting Taxonomies, ...


2

You can use getTerm method in sp.taxonomy.js library. //Current Context var context = SP.ClientContext.get_current(); //Current Taxonomy Session var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context); var term=taxSession.getTerm("id of the term"); See more details here . http://msdn.microsoft.com/en-us/library/office/...


2

I've had good success with this tutorial So if the guid for Sales and Marketing is c8a43f13-5ea1-45f2-b46d-3a1986a1cbd7 this would get all things tagged with a child of that. owstaxIdItemType:"GPP|#c8a43f13-5ea1-45f2-b46d-3a1986a1cbd7" But that wouldn't include anything that is actually tagged Sales and Marketing. If you want to have that included you ...


2

GetTerms returns a TermCollection object, which, even if it's empty, will not be null. You probably want to do something like: TermCollection results = termSet.GetTerms("MyTerm", false); if (results.Count == 0) { termSet.CreateTerm("MyTerm", 1033); termStore.CommitAll(); }


2

omg, I found the error, and I cant find an explanation on this, hopefully somebody at Microsoft can tell me. this line: var termStore = termStores.getByName("Taxonomy_kl5tZjInn7STsFTzIE7n3Q=="); We noticed the name is now different, it has a different guid, but we as customers cant change that name, so the only reason is Microsoft changed it for ...


2

You may need to manually refresh the cache; if you are trying to use the term immediately after creating it then it may not have had enough time to propagate. If you are using JSOM, try adding a call to termStore.updateCache() in the executeQueryAsync function, like below:. var termSetId = "77ccf69b-b17e-40cf-8589-7bebc8ee6c9c" var newGuid = SP.Guid.newGuid(...


2

Unfortunately you cannot import labels using OOB import functionality. I recommend using Lapointe.SharePoint.PowerShell.wsp found here and here to do the import. It supports also labels. You can do first an export to get sample XML out, then modify it, and finally do import. It will not overwrite existing terms (will throw error), so you need want to remove ...


2

There are couple options you can try. You can call TermSet.GetAllTerms() method to return all terms under that TermSet. Another approach you can try is to use recursive function to enumerate termSet.Terms and term.Terms I list the code for approach 1 at the following. You can check term.PathOfTerm to find out the term's hierarchy information. class ...


2

Radu Tut wrote the post Managed Metadata Navigation for Multiple Site Collections in SharePoint 2013, stating: "When you try to bind the same navigation term set to a new site, you will get a message that says the term set is already bound to a different site, and if you choose to proceed, the navigation settings for the other site will be broken." ...


2

Add a pipe e.g. '|' to the list 'Qualifications;BSc|BA'


2

I think you can use it for long time as long as that term is exist in the term stores. as this property "A 32-bit integer that uniquely identifies the list item containing the taxonomy field in a list" Here is good explanation of the wssid When you assign value a TaxonomyField, an item is created for the selected Term (or if there is already an item ...


2

There is a known bug where single select taxonomy terms will not return the expanded/human readable label. If you can change your field to multi-select they will expand correctly. Of course that might not be a good choice for other reasons. Otherwise you can do a couple of things. Instead of using a GET call to the /items you can use a POST to the ...


2

Use two different fields, one scoped for your IT/HR term set, the other field scoped to your Template term set.


2

You could just use the pnp cmdlet Get-PnPTerm to get all Terms and its GUID under specific termsets. It's very easy. Read here for more: https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/get-pnpterm?view=sharepoint-ps


1

Looks like your app doesn't have permission to write data to the term store. To provide permission , go to the Appmanifest.xml file and provide write permission the Taxonomy scope. Deploy the app again and it should work now.


1

In C# Server object model, you can try it as below: TaxonomySession taxonomySession = new TaxonomySession(site); TermStore termstore = taxonomySession.DefaultSiteCollectionTermStore; Guid termSetGuid = new Guid("fdc98309-c520-44eb-a5ca-f2a04d8dd541"); TermSet breadcrumbTermSet = termstore.GetTermSet(termSetGuid); TermCollection terms = breadcrumbTermSet....


1

When you enable Managed navigation for a site , the navigation node title is stored as a local custom property named _Sys_Nav_Title . So if you want to get this data from JSOM you could use below code: spTerm.get_localCustomProperties()["_Sys_Nav_Title"];


1

You need to pass the value in query string like this: locationtag=%230TermGUID* replace TermGUID above with the guid of the Term


1

I don't know if it is exactly usable in your situation, but maybe it helps: In PowerShell you can use the GetPath() method and count the semicolons. Example: Root      \- Child GetPath() used on 'Child' returns 'Root;Child' - so the nesting level is the count of the ';'. Additionally there is the 'isRoot' property to quickly ...


1

Below is the function I use and it creates Creates the new term under root itself (Term set node) Works on any page as all the dependencies are loaded within the script function create(termName) { var scriptbase = _spPageContextInfo.siteAbsoluteUrl + "/_layouts/15/"; $.getScript(scriptbase + "SP.js", function(){ $....


1

You can make use of properties Terms or TermsCount. This property provides the list of immediate Terms. So in your case you can use following logic if(term.Terms == null || term.Terms.Count == 0) //means this term has no childern if(term.TermsCount == 0) //means this term has no childern


1

You can use Script Created by http://blog.falchionconsulting.com/index.php/downloads/ There is a cmdlet that allows to export terms into an XML file and another cmdlet that allows importing from xml file. http://www.falchionconsulting.com/PowerShellViewer/Default.aspx?Version=SP2010&Cmdlet=Export-SPTerms http://www.falchionconsulting.com/...


1

You can get the store (by name) then the SP.Taxonomy.TermCollection and then the term by name. Based on: Working with Taxonomy and JavaScript in SharePoint 2013 $(document).ready(function(){ var scriptbase = _spPageContextInfo.webServerRelativeUrl + "_layouts/15/"; $.getScript(scriptbase + "SP.Runtime.js", function () { $....


1

How to retrieve Term via SharePoint JSOM Use SP.Taxonomy.TaxonomySession.getTerm Method to get a Term object that is based on Term IDs: function getTerm(termId,success,failure) { var context = SP.ClientContext.get_current(); var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context); var term=taxSession.getTerm(termId); ...


1

If you know there term ID which you can get from the MMS Term Store Manager or the Tag Summary Page you can your the following syntax to get all descendant children of the MMS property ItemType (the # at the beginning indicates child terms): owstaxIdItemType=#52263385-1fc3-4323-8d6b-50c8f6c3c45d:"reference materials" Ref: http://msdn.microsoft.com/en-us/...


1

When you get the "Object reference not set to an instance of an object" that means that it's expecting not null value and you give it null value. The cast that you are making is returning null. var taxField = item["Application"] as TaxonomyField; Since you are geting the lable of only one field "Application" you can check if it is a Multiple Value Field ...


1

I think this article should help you: http://msdn.microsoft.com/en-us/library/office/ff625182(v=office.14).aspx It says: By passing true to the bool includeDescendants parameter to TaxonomyField.GetWssIdsOfKeywordTerm, you get the lookup IDs for the term with the specified GUID, and you get the IDs for all its child terms. Once you get ID you can query ...


Only top voted, non community-wiki answers of a minimum length are eligible