0

I am working on an Enterprise wiki site collection inside SharePoint Server 2016. and i wrote the following event receiver which get fired when an item is updated, here is part of my event receiver which is causing the issue:-

TermSet ts = g.TermSets[termsetname.Trim()];
foreach (Term t56 in ts.Terms)
          {
              string targetPageURL = t56.LocalCustomProperties["_Sys_Nav_TargetUrl"]

now the above is raising the following exception :-

The given key was not present in the dictionary.

now i remember i use to do this inside my sharepoint 2013 and it is working well. but not sure if inside sharepoint 2016 i can not use LocalCustomProperties["_Sys_Nav_TargetUrl"] to get the target page for my navigation term ?

Thanks

0

I think you need to use _Sys_Nav_SimpleLinkUrl key to fetch the value of url.

So, your code would be:

TermSet ts = g.TermSets[termsetname.Trim()];
foreach (Term t56 in ts.Terms)
{
     string targetPageURL = t56.LocalCustomProperties["_Sys_Nav_SimpleLinkUrl"];

Dont remember about SP 2013, but in case of SP Online and 2016, we have used _Sys_Nav_SimpleLinkUrl in the code only and it fetches the url associated with the term.

Update - In case you have configured the term to use Term Driven Page with Friendly URL, then _Sys_Nav_TargetUrl will work. If you have configured the term to use Simple Link or Header, then you will need to use _Sys_Nav_SimpleLinkUrl property.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.