Quantcast
Channel: Question and Answer » term-store
Viewing all 40 articles
Browse latest View live

LabelMatchInformation not case-insensitive?

$
0
0

I’m having some issues with using LabelMatchInformation to search for terms in the managed metadata service. I’m searching for my terms like this:

var labelMatchInfo = new LabelMatchInformation(clientContext)
{
    TermLabel = searchTerm,
    DefaultLabelOnly = true,
    StringMatchOption = StringMatchOption.StartsWith
    ResultCollectionSize = maxMatchCount,
    TrimUnavailable = true
};

var termResults = termStore.GetTerms(labelMatchInfo);

Where searchTerm is what I’m searching for.

Documentation at https://msdn.microsoft.com/en-us/library/hh626704%28v=office.12%29.aspx (I’ve highlighted the relevant section with bold):

The LabelMatchInformation.TermLabel (section 3.1.5.30.1.1.6) cannot be null or empty, and MUST NOT exceed 255 characters in length. It also cannot contain any of the following illegal characters: ; ” < > | & tab
The search is case-insensitive, and will match either the entire label or only check that it starts with the specified string depending on the value of the LabelMatchInformation.StringMatchOption (section 3.1.5.30.1.1.5) parameter. If the LabelMatchInformation.StringMatchOption is not set, it defaults to exact match.

This clearly states that the search should be case-insensitive; however, I’ve found that to not be the case. An example: searching for lever returns the terms leveranse personkunde, levert til kunde, leverandør. However, a search for Lever (capital L), returns Leveranse Bedrift. The expected result would be that either search term would return the full result set including all of leveranse personkunde, levert til kunde, leverandør and Leveranse Bedrift.

What is going on here? Is the documentation wrong, or have I misinterpreted how this is supposed to work? I’m a bit confused by the function description at the top of the documentation above. It reads:

Gets a collection of all Term (section 3.1.5.16) objects from the current TermSet (section 3.1.5.20) object based on the label criteria provided.

However, I’m calling the GetTerms function on a TermStore object, so where does the “current TermSet” come from? All of the lowercase terms are in the default Keywords term set, while the uppercase one is in a manually created term set. However, both term sets reside in the same term store. Does the GetTerms function just look for the first term set containing a match, and then ignore the rest?

UPDATE:

I’ve now established that it completely ignores the StringMatchOption if set to ExactMatch too, and always makes the call as if it was set to StringMatchOption.StartsWith. Am I looking at outdated/wrong documentation here? Or is it just the documentation itself that is incorrect?


Metadata term links in a list

$
0
0

I am currently using the term store to keep a list of ‘Business Units’, ‘Locations’, and ‘Services’.

I have assigned my terms a ‘Simple Link or Header’ link (to a site page). However in a list view those terms appear as plain text, rather than a hyper-linked term.

Is there a way to make terms in a list view appear with their hyperlink still intact?

This is to avoid having to create custom URL columns which have to be manually populated. The term store was a potential solution to this but it seems that we may need another.

Restrict access to documents associated with a certain term

$
0
0

I need to restrict access to all documents that are associated with a certain term only to some users. This should be done for both existing documents, and future documents, on upload.

How can I achieve this?

Get Taxonomy Terms, GUIDs, Synonyms (Other Labels) into Array within a SharePoint Page (not App)

$
0
0

I am using the code below to get terms (Later I will push these into an array). This is based on this article: http://www.vrdmn.com/2012/12/working-with-taxonomy-and-javascript-in.html

It is pushing the term names, but I also need to get the term guid and synonyms. My goal is to have a nested dropdown somewhat like the one in this SO question.

So the goals are as follows:

  1. Get all terms, synonyms, and guids pushed into an array

Here is my code for the taxonomy:

$(document).ready(function () {
execOperation();
});

function execOperation() {
    //Current Context
    var context = SP.ClientContext.get_current();
    //Current Taxonomy Session
    var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);
    //Term Stores
    var termStores = taxSession.get_termStores();
    //Name of the Term Store from which to get the Terms.
    var termStore = termStores.getByName("Taxonomy_11111111111==");
    //GUID of Term Set from which to get the Terms.
    var termSet = termStore.getTermSet("1111111-111-111-11111111");
    var terms = termSet.getAllTerms();
    context.load(terms);
    context.executeQueryAsync(function () {
        var termEnumerator = terms.getEnumerator();
        var termList = "Terms: n";
        while (termEnumerator.moveNext()) {
            var currentTerm = termEnumerator.get_current();
            termList += currentTerm.get_name() + "n";
        }
        alert(termList);
    }, function (sender, args) {
        console.log(args.get_message());
    });
}

Query Taxonomy Term Store list and display as navigation link

$
0
0

I have been given a navigation challenge.

We have multiple site collections on a farm, that we ultimately want to have a navigation link list that is global between all site collections.

The links are defined in a global Term Store, and we want each site to use that as their navigation list, but apparently this isn’t straightforward according to our one developer.

It seems a suggested solution would be to somehow query this Term Store list and populate the links on each site collection.

I came across this link ->
http://www.vrdmn.com/2012/12/working-with-taxonomy-and-javascript-in.html

am I on the right track with that link? Which peice of code is the right one to use of the suggested 5? (Im new to sharepoint and VERY new to the idea of term sets. Not sure what is the right approach here to query and generate the list of links- parent and children)

Is there maybe another way?

Thanks!

Rename Term store (root) with powershell – managed metadata service

$
0
0

Is there a way to rename Term store “root” node? (yellow in the picture below)

enter image description here

I’ve tried

$taxonomySession = Get-SPTaxonomySession -Site $gurl
$termStore = $taxonomySession.TermStores["Managed Metadata Service Application"]
$termStore.Name = "Managed Metadata Service"

without luck :(

how to re-use an existing term under another term but not termset

$
0
0

My problem is I can’t reuse a term under another term. But reuse term under a termset works fine. How can I reuse a term under another term. What I’m trying to do here just works fine with web interface. But when it comes to powershell, I’m stuck.

Code below works fine but it puts reused term in the root of the target termset. But the source term is under level 2, I mean it’s under another term, not direcly under root.

$sourceterm = $mytermstore.GetTerm("66c67639-db8a-4101-8778-afbf10bef644");
$tset = $mytermstore.GetTermSet("186fcb82-4aea-4a79-b2dd-77b3895b533b")
$reusedTerm = $tset.ReuseTerm($sourceterm, $False)
$mytermstore.CommitAll()

I tried to use a term as target like below but I get error. Obviously term does not have ReuseTerm method.

$sourceterm = $mytermstore.GetTerm("66c67639-db8a-4101-8778-afbf10bef644");
$parentTerm = $mytermstore.GetTerm("186fcb82-4aea-4a79-b2dd-blah")
$reusedTerm = $parentTerm.ReuseTerm($sourceterm, $False)
$mytermstore.CommitAll()

I’m trying to reuse the existing term powershell2 under Courses under next termset Variations Navigation (tr)

enter image description here

How to validate current user permissions for a given Term Store Group using CSOM

$
0
0

I can’t seem to find a way to check for the current user permissions for a term store group or term set in Sharepoint Online.
I know the REST interface does not support any kind of interaction with the taxonomy service, so I’ve already discarded it has an option, but I’m wondering if this is achievable through CSOM or JSOM.

The reason I need to do this is because we have a custom page to create terms under specific term sets and I want to check the user’s write access to this term sets before letting him do any editing.


Application pool user is a member of termstore administrator

$
0
0

Hi i want to run a user as administrator to create terms.

 SPSite site = SPContext.Current.Site;
        SPSecurity.RunWithElevatedPrivileges(() =>
        {
            using (SPSite secureSite = new SPSite(site.ID))
            {
                TaxonomySession ts = new TaxonomySession(secureSite);
                TermStore termStore = ts.TermStores["Managed Metadata Service"];
                Group group = termStore.Groups["MyGroup"];

                TermSet termSet = group.CreateTermSet("Termset");

                termSet.CreateTerm("Term", 1033);

                termStore.CommitAll();

            }

I can only create terms if the current user are a Contributor in the termstore, but i want to run this user as administrator without adding the user to the contributor in the term store?

When to use “Tree view” or when to use “Managed navigation” , if i want to be able to filter my pages using term store

$
0
0

Seems there are two main approaches if I want to be able to filter my wiki pages using metadata term store inside enterprise wiki site collection.

First Approach. Tree View Approach is to do the following:-

  • Enable the “Metadata Navigation and Filtering” site feature inside my site collection.
  • Go to “Site Setting >> Tree View >> enable tree view”
  • Got to “Library settings >> Metadata Navigation Settings”, configure the fields to be displayed.
  • The result is that I will get all the current term store fields inside a tree as follow:-

    enter image description here

Second Approach. Managed Navigation Approach is to do the following:-

  • Go to Site Setting>> Navigation.
  • Chose Managed Navigation under the Global navigation,
  • Chose the wiki category , from the term store.
  • The result will be that I will get managed navigation at the top;

enter image description here

Now i am not sure which approach is the correct one to follow & what are the differences between the two approaches?

From my side I find the following differences:-

  • Using tree view is more user friendly and will allow having extra columns inside the tree, this can be controlled using ” Metadata Navigation Settings” under the library settings.
  • While using the managed navigation , I can only chose to have one term set such as the default wiki category. And the look and feel is not very user friendly

Now as I mentioned before the idea is that I want the ability to click on a term and get all the wiki pages that have been tagged using this term.
Although both solutions will not allow metadata filtering to be done out of the box, for example using tree view I have to deploy the following solution to enable this (link), otherwise clicking on any term inside the Tree view will just redirect to the home page.. while for the managed navigation I did not use this before..

public class CustomWikiPageBase : PublishingLayoutPage
{
    protected override void OnInit(EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request.QueryString["TreeField"]) 
            && !String.IsNullOrEmpty(Request.QueryString["TreeValue"]))
        {
            Response.Redirect(String.Format("{0}?TreeField={1}&TreeValue={2}",
                SPContext.Current.ListItem.ParentList.DefaultViewUrl,
                Request.QueryString["TreeField"],
                Request.QueryString["TreeValue"]));
        }
        else if (!String.IsNullOrEmpty(Request.QueryString["TreeField"]))
        {
            Response.Redirect(String.Format("{0}?TreeField={1}",
                SPContext.Current.ListItem.ParentList.DefaultViewUrl,
                Request.QueryString["TreeField"]));
        }
        base.OnInit(e);
    }
}

Insufficient permissions to user for create/delete term

$
0
0

I have created child term inside selected term from code behind. Now when I try to delete or create term with same user then I got “The current user has insufficient permissions to perform this operation.” error.

Previously it was work but currently it is not working. I have given “Term Store Administrators” permission to my current user. I have written same code as I have written for at the time of creating new page.

My code block (I’m getting exception in term creation line):

        try
        {
    SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                TaxonomySession session = new TaxonomySession(sitecollection);
                TermStore termStore = session.TermStores["Managed Metadata Service"];
                Group group = termStore.Groups["GroupName"];
                TermSet sTermSet = group.TermSets["S"];

        if (!string.IsNullOrEmpty(hdnAllSelectedTermGuiIds.Value))
                    {
                        string[] newTerms = hdnAllSelectedTermGuiIds.Value.TrimEnd(',').Split(',');

                        for (int i = 0; i < newTerms.Length; i++)
                        {
                                try
                                {
                                    Guid termId = new Guid(newTerms[i]);
                                    Term termObj = structureTermSet.GetTerm(termId);
                                    Term newTerm = termObj.CreateTerm(hdnPageName.Value, langCode);
                                }
                                catch (Exception ex2)
                                {

                                }
                        }
                        sTermSet.TermStore.CommitAll();
                    }
            });
        }
        catch (Exception ex)
        {

        }

Is there any solution for this?

More than 1 Term set for a managed metadata column

$
0
0

Is it possible to have a column with more than one term set associated?

I read that is possible to associate a MM column with a group but I don’t know if I’m missing something

SharePoint 2013 Manage Metadata Term Store Orphaned Terms Delete

$
0
0

I’m Facing a problem with Orphaned Terms,
I cannot delete them from term store management tool under Managed Metadata Service Application.

Is there is anyway to clear it?

I try to delete them using powershell and I get this exception

This operation is invalid in the Orphaned Terms term set. The operation failed.

enter image description here

get all child terms

$
0
0

I want to get all terms including child. Currently have 3 Levels but it may increase so cannot hard code. Here is code which just give me parent terms.

string spWebUrl = SPContext.Current.Web.Url;
        using (SPSite site = new SPSite(spWebUrl))
        {
           TaxonomySession taxonomySession = new TaxonomySession(site);

           //get the default one
            TermStore termStore = taxonomySession.TermStores["OrganisationChart"];
           /* or you can get the one you want by looping through all the term stores
             taxonomySession.TermStores
           */

           var group = termStore.Groups["MyGroup"];

           TermSet termSet = group.TermSets["MyTermSet"];


            TermCollection terms = termSet.Terms;

            foreach (var t in terms)
            {
                Console.Write(t.Name);

            }

        }

Is it also possible to store this information in list on fly?

Update1
I dont need flat list by using GetAllTerms.

Reused term + Sharepoint + Powershell

$
0
0

How can I access reuse terms in powershell. I have total 6 terms out of that 2 are reused, through powershell script I am able to get 4 terms only, The 2 reused terms are not coming, is there any way to get that aswell?

Using sharepoint 2013

Regards
Anand


User profile synchronization – AD –“&” character triggers update on users

$
0
0

When doing a sync against AD almost every user get updated. And this happens every time I’m doing a sync!

enter image description here

When I look at FIM it looks like SPS-Deparment detects changes because AD has a different &-character than that SharePoint stores in the termset. look at picture

enter image description here

I know that SPS-Department is a termset so I think that terms have to be in UTF-8 but I’m not sure about what char is in the AD.

Is there a workaround? I cannot change every “&” char in AD because they have many systems that relies on AD.

Another question.. is “&” a legal character in AD?

View items using a term and include it's children

$
0
0

Is it possible for me to create a view that when I enter a term and the result is a list of all items with that term associated with it but also have it return the children of the entered term as well.

Example
Terms:

  • Microsoft
    • Office
    • Outlook

So if we were so say that the term we search for is Microsoft, it will filter for that term and it’s children.

Currently we are using a URL filter so that when you arrive at the page it will filter Microsoft but we cannot see a way for it to automatically filter for the terms Children as well.

Termstore invalid GUID after migrating

$
0
0

A site has been migrated from one environment to another. Some of the site columns in the site which have terms to select from the term store, are displaying as red. I am thinking that is due to different GUIDS? Simply changing the column value to the term store again in the new site doesn’t solve the issue.

What is the software boundaries for labels in a SharePoint 2013 term store

$
0
0

I should say I’m not an expert when it comes to the Managed Metadata Service, but I am trying to find out the software boundaries for labels in SharePoint 2013 and I’m a bit confused.

According to https://technet.microsoft.com/en-us/library/cc262787.aspx#termstore the supported number of “variation labels” in the term store is 209. But does that mean that the total number of “labels” in the whole term store should not exceed 209 or are “variation labels” something completely different?

Would that mean that if I had 20 terms in a term store I would only be able to create roughly 10 labels on each of these terms? It just seems a bit limiting to me.

Tagging best practice for N/A or ALL tags (tagging language for images)

$
0
0

I’m wondering how to correctly tag documents when the tag doesn’t apply to it. The best exemple is trying to tag an image with a language tag.

Which solution is the best with sharepoint 2013 :

1° Create a tag N/A amongst the language tag (English, French, German, etc …). However, users might get confuse and tag wrongly. Worst, user might look for documents in english by default and miss information stored as images.

2° Tag all languages knowing that if I add a language later (swedish) it will not be tagged on previously introduced image.

3° Using hierachical managed metadata and create a Tag “ALL” which has subtag “English”, “French”, “German”. Therefore creating a hierarchy.

4° Does it exist other options like a generic tag which would select all tag even the one we add in the future ? like ‘*’

Viewing all 40 articles
Browse latest View live