tag:blogger.com,1999:blog-4455058894110083658.post4690214909974566372..comments2024-02-26T22:59:25.161+00:00Comments on Vardhaman Deshpande: Working with Taxonomy and JavaScript in SharePoint 2013Vardhaman Deshpandehttp://www.blogger.com/profile/17919845281919756108noreply@blogger.comBlogger34125tag:blogger.com,1999:blog-4455058894110083658.post-19705700868496482052020-02-19T04:51:53.979+00:002020-02-19T04:51:53.979+00:00Nice blog
Do you have any example of pnp.js Taxono...Nice blog<br />Do you have any example of pnp.js Taxonomy in javascript to extract terms from termset <br />Preeti Parag Patkihttps://www.blogger.com/profile/11388628462731634835noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-72477879178453590842019-12-26T10:36:09.103+00:002019-12-26T10:36:09.103+00:00error
Specified argument was out of the range of v...error<br />Specified argument was out of the range of valid values<br /><br /><br /><br /><br /><br /> function getTerm() {<br /> debugger;<br /> var clientContext = SP.ClientContext.get_current();<br /> var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(clientContext);<br /> var termStores = taxSession.get_termStores();<br /> var termStore = termStores.getByName("Site Collection - sp2013dev1-11111");<br /> var termSet = termStore.getTermSet("17774198-e308-439e-bde4-13e4d5b43e6e");<br /> var terms = termSet.getAllTerms();<br /> clientContext.load(terms);<br /><br /> clientContext.executeQueryAsync(Function.createDelegate(this, function (sender, args) {<br /> var termEnumerator = terms.getEnumerator();<br /> //var getItems = new Array();<br /> while (termEnumerator.moveNext()) {<br /> var currentTerm = termEnumerator.get_current();<br /> alert("name" + currentTerm.get_name());<br /> }<br /> }), Function.createDelegate(this, function (sender, args) {<br /> alert(args.get_message());<br /><br /> }));<br /> }<br />Nikhilhttps://www.blogger.com/profile/16103841975527909055noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-75645141372373973262018-04-06T04:56:22.468+01:002018-04-06T04:56:22.468+01:00please help me.. i am delcare in javascript but i ...please help me.. i am delcare in javascript but i have error var context = SP.ClientContext.get_current(); that say "Cannot find name 'SP'" how to declare SP. in type scrpt ?Syaiful.Bloghttps://www.blogger.com/profile/11127794242727976909noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-32273141921380915552017-07-23T19:44:10.401+01:002017-07-23T19:44:10.401+01:00Thanks a lot for sharing all this valuable informa...Thanks a lot for sharing all this valuable information :-)DennisKuhnhttps://www.blogger.com/profile/02283539899852084638noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-50326004845717726232017-02-19T18:34:01.990+00:002017-02-19T18:34:01.990+00:00Hi Vardhaman.
Thanks for sharing the article and...Hi Vardhaman. <br /><br />Thanks for sharing the article and code. This was a great start for what I was trying to achieve by modifying your code. Avi Pawarhttps://www.blogger.com/profile/00608755143552926436noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-49597297342301717112015-12-04T09:35:43.944+00:002015-12-04T09:35:43.944+00:00Can you please clear the "_spPageContextInfo....Can you please clear the "_spPageContextInfo.webServerRelativeUrl"?Anonymoushttps://www.blogger.com/profile/08775840353668850799noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-49166173412427878442015-07-01T06:25:13.116+01:002015-07-01T06:25:13.116+01:00How to get all the term sets?How to get all the term sets?ARUNhttps://www.blogger.com/profile/06803860201304523854noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-52832804956786642752015-06-10T18:28:24.694+01:002015-06-10T18:28:24.694+01:00hi Vardhaman. Thanks for sharing nice article. wor...hi Vardhaman. Thanks for sharing nice article. worth reading it.<br /><br />i am having one issue. the enumerator object is throwing error when i tried to get multi select meta data column values.<br /><br />below is the async success method code. where collListItemTopics is list item collection which was loaded before calling async function.<br /><br />function onQuerySucceeded(sender, args) {<br /> var listItemEnumerator2 = collListItemTopics.getEnumerator();<br /> while (listItemEnumerator2.moveNext()) <br /> {<br /> var oListItem = listItemEnumerator2.get_current();<br /><br /> var taxEnumerator = oListItem.get_item(colTopicName).getEnumerator(); //error here//<br /><br />while(taxEnumerator.moveNext())<br /> {<br /> var currentTerm = taxEnumerator.get_current();<br /> var disText = currentTerm.get_label();<br /> alert(disText);<br /> }<br /><br /> }<br />}Rajhttps://www.blogger.com/profile/09840291853755874254noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-31075481294544158982015-02-27T11:45:00.734+00:002015-02-27T11:45:00.734+00:00While executing i am getting below error
"SC...While executing i am getting below error<br /><br />"SCRIPT438: Object doesn't support property or method 'get_path' "<br /><br />Can you please provide any suggestions?student zonehttps://www.blogger.com/profile/06658419321013573862noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-34913315519792820892015-01-06T16:00:55.268+00:002015-01-06T16:00:55.268+00:00Thanks for your comprehensive article. Hugely valu...Thanks for your comprehensive article. Hugely valuable, as there is still a distinct lack of JS CSOM code on the Microsoft sites!<br />At last i feel like I have a good start point for walking the tree of nodes in my SP App.<br />You are my Blogger of the week!Ruth Jhttps://www.blogger.com/profile/01361175818154700002noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-50380897785681883242014-12-26T05:06:17.145+00:002014-12-26T05:06:17.145+00:00Hi,
thanks for the great article .
I tried to ite...Hi,<br />thanks for the great article .<br /> I tried to iterate through the childterms from a parent term within a termset using power shell.<br />but it didn't work. I used <br />mterm.getallterms(); method.. <br />but I am getting the error,getallterms is not defined.SaMolPPhttps://www.blogger.com/profile/04702481218557567435noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-895361346946527602014-11-05T06:59:14.862+00:002014-11-05T06:59:14.862+00:00Hello, everthing works fine when I call this funct...Hello, everthing works fine when I call this function once in single page. But if I need same function twice at "same" page It says fatal error "The collection has not initialized...." I use it on single page application and it is not working when i change route and turn back where i used that function. Just working once and when i refresh the pagecanperkhttps://www.blogger.com/profile/08912159380356755118noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-10961975390116361912014-03-07T09:22:11.786+00:002014-03-07T09:22:11.786+00:00One can retrieve the configured simple url by quer...One can retrieve the configured simple url by querying the local custom properties using the function get_localCustomProperties on the term object. You will find a key that is called "_Sys_Nav_SimpleLinkUrl".Carlhttps://www.blogger.com/profile/08930800685621371296noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-33456583868839631622014-02-21T22:49:38.229+00:002014-02-21T22:49:38.229+00:00get pages current navigation term via javascript
...get pages current navigation term via javascript<br /><br />var ctx = SP.ClientContext.get_current();<br /> var web = ctx.get_web();<br /> //get nav termset for current web<br /> var currentTermSet = SP.Publishing.Navigation.TaxonomyNavigation.getTermSetForWeb(ctx,web,"CurrentNavigationTaxonomyProvider",false);<br /><br /> //get term for current URL<br /> <br /> <br /> ctx.load(currentTermSet);<br /> ctx.executeQueryAsync(<br /> function() {<br /> var currentTerm = currentTermSet.findTermForUrl(window.location.pathname);<br /> ctx.load(currentTerm);<br /> ctx.executeQueryAsync(<br /> function() {<br /> //save to global window.currentTermId = currentTerm.get_id();<br /> setUrlsByTerm(window.currentTermId);<br /> },function (sender, args) {<br /> console.log('error retrieving term');<br /> }<br /> );<br /> },<br /> function (sender, args) {<br /> console.log('error retrieving termset');<br /> }<br /> );<br /><br /><br />hope that helpsAndrewhttps://www.blogger.com/profile/05239948825864501552noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-33741253949513884932014-01-26T15:22:36.803+00:002014-01-26T15:22:36.803+00:00resolved, instead of doing getting term store by n...resolved, instead of doing getting term store by name, i get the default site collection term store. hope this helps someone.<br /><br />var termStores = termSession.getDefaultSiteCollectionTermStore();<br /> var termSet = termStores.getTermSet("83be3427-9474-4b46-bc9e-2b0ca75fbd95");Kashifhttps://www.blogger.com/profile/15818606513942209913noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-71673491846550815772014-01-26T14:46:59.765+00:002014-01-26T14:46:59.765+00:00Nice article, at least it helped me understand the...Nice article, at least it helped me understand the bits. But my "context" is different than my site collection. Context is http://myprefix-332233.my.domain.com/TestApp/Default/Page whereas I am suppose to fetch term store collection from my site collection http://site.domain.com/. How would that work? I tried creating an appcontext and passing that but it fails. Any help would be greatly appreciated. Thanks,Kashifhttps://www.blogger.com/profile/15818606513942209913noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-85352968026318033382013-12-12T11:18:59.990+00:002013-12-12T11:18:59.990+00:00There will not be a direct way to return a value f...There will not be a direct way to return a value from the executeQueryAsync function as its an AJAX function. You might probably want to use common variables to pass the data.Vardhaman Deshpandehttps://www.blogger.com/profile/17919845281919756108noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-28037479501951924062013-12-09T20:56:29.096+00:002013-12-09T20:56:29.096+00:00Hey Vardhaman, I just stumbled across your solutio...Hey Vardhaman, I just stumbled across your solution here, awesome writeup, but I do have a question.<br /><br />Is there a way to return a variable from the execOperation function. I would like to get the label of a Managed Metadata column and then display it within a local function.<br /><br />I can alert() my Managed Metadata label within the execOperation function, but if I try to return it to the function containing the GetScripts, I cannot get the value. Nor from my originating function. Thoughts?<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-5264791283073107482013-09-30T11:15:27.122+01:002013-09-30T11:15:27.122+01:00@Anonymous
It's hard to determine what could ...@Anonymous<br /><br />It's hard to determine what could be wrong without looking at the code. Can you post your question and code on a SharePoint forum like StackExchange?<br /><a href="http://sharepoint.stackexchange.com/" rel="nofollow">http://sharepoint.stackexchange.com</a>Vardhaman Deshpandehttps://www.blogger.com/profile/17919845281919756108noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-41700167946773304312013-09-30T06:21:02.560+01:002013-09-30T06:21:02.560+01:00Hi
i copied your exact code and replaced the name...Hi<br /><br />i copied your exact code and replaced the names and guid with mine, i am getting following error. What i am doing wrong , can u help<br /><br />Specified argument was out of the range of valid values. Parameter name: index<br /><br />thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-49624220457036518772013-08-22T13:02:19.445+01:002013-08-22T13:02:19.445+01:00Hey,
How can I get the friendly URL of the term?Hey,<br />How can I get the friendly URL of the term?Anonymoushttps://www.blogger.com/profile/16504974033929710504noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-6389872525855135752013-08-03T06:48:12.467+01:002013-08-03T06:48:12.467+01:00Not as far as I know sorry.Not as far as I know sorry.Vardhaman Deshpandehttps://www.blogger.com/profile/17919845281919756108noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-54207190868495434122013-08-02T22:56:14.546+01:002013-08-02T22:56:14.546+01:00Thanks Vardhaman!
But is there a way to get the cu...Thanks Vardhaman!<br />But is there a way to get the current pages navigation term using jquery/client object model(you described above using SP.Taxonomy.js) and not server side model.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-12865888212405511712013-08-01T16:06:50.958+01:002013-08-01T16:06:50.958+01:00You can get that using the Server Object Model:
ht...You can get that using the Server Object Model:<br /><a href="http://www.lifeinsharepoint.co.uk/2013/04/02/quick-tip-sharepoint-2013-managed-navigation-term-current-page-code/" rel="nofollow">http://www.lifeinsharepoint.co.uk/2013/04/02/quick-tip-sharepoint-2013-managed-navigation-term-current-page-code/</a>Vardhaman Deshpandehttps://www.blogger.com/profile/17919845281919756108noreply@blogger.comtag:blogger.com,1999:blog-4455058894110083658.post-20686571515042329052013-07-31T06:29:21.413+01:002013-07-31T06:29:21.413+01:00Excellent Article!
How can I get the site's c...Excellent Article! <br />How can I get the site's current navigation Term? I have managed navigation enabled for the site. When on a page I need to get the current navigation term for the page.Anonymousnoreply@blogger.com