2010-03-26 39 views
3

在SP2010中使用託管的元數據,我可以獲得分類學會話,術語庫和術語,但是當我嘗試從術語中檢索術語時設置,我得到一個TermStoreOperationException,它說「它無法讀取或寫入數據庫」。Sharepoint 2010託管元數據 - 無法從術語集中獲取術語

有沒有人有任何想法,爲什麼我可以得到術語集,但不是條款?我不明白爲什麼當他們都住在同一個數據庫中時,我可以得到這個集合,但不是它裏面的條款。

我正在使用的代碼如下:

TaxonomySession txSession = new TaxonomySession(site, true); 

    TermStore termStore = txSession.DefaultSiteCollectionTermStore;     

    TermSet termSet = termStore.GetTermSet(TermSetId); 
    TermCollection termCollection = termSet.GetTerms("My Term", true); //exception thrown on this line. 

任何意見或見解和解決方案將非常感激。

謝謝堆!

回答

2

我設法獲得期限來解決這個問題只需使用的術語集索引:

TermSet termSet = termStore.GetTermSet(txField.TermSetId); 
Term myTerm = termSet.Terms["My Term"]); 

我不知道爲什麼.GetTerms()不工作 - 這可能是因爲SP2010仍然不是RTM,它意味着是一種內部方法,或其他一些超出我理解的神祕原因...