TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get Taxonomy Value from Sharepoint 2013
Devarajan Sm
Feb 02
2016
Code
651
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
protected
void
TaxonomyGetTermName(
string
url,
string
strTermName)
{
string
valueOut =
""
;
try
{
using
(ClientContext clientContext =
new
ClientContext(url))
{
clientContext.Credentials =
new
NetworkCredential(
"id"
,
"pwd"
,
"domain"
);
//
// Load up the taxonomy item names.
//
TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
TermStore termStore = taxonomySession.GetDefaultSiteCollectionTermStore();
clientContext.Load(termStore,
store => store.Name,
store => store.Groups.Include(
group => group.Name,
group => group.TermSets.Include(
termSet => termSet.Name,
termSet => termSet.Terms
).Where(termSet => termSet.Name == strTermName)
//.Where(termSet => termSet.Name == "termname")
).Where(group => group.Name ==
"groupname"
)
);
clientContext.ExecuteQuery();
if
(taxonomySession !=
null
)
{
if
(termStore !=
null
)
{
foreach
(TermGroup group
in
termStore.Groups)
{
Console.WriteLine(
"Group "
+ group.Name);
foreach
(TermSet termSet
in
group.TermSets)
{
Console.WriteLine(
"TermSet "
+ termSet.Name);
foreach
(Term NameLable
in
termSet.Terms)
{
NameLable.CustomProperties.TryGetValue(
"idofID"
,
out
valueOut );
DictionaryName.Add(NameLable.Name.ToLower(), valueOut );
}
}
}
}
}
}
}
catch
(Exception ex)
{
}
}
Get Taxonomy Value
Sharepoint 2013