5

In a dll in C# I get the tcm of a component. This component is placed in the metadata of a strucure group.

What I need is to get the url of the page that is using this component. Ultimately what I need to do in C# is the same that Tridion does when you write tridion:href@@component@@

Thanks!!

1
  • Welcome to Tridion Stack Exchange. What you tried so far? Are you referring to C# or Dreamweaver? Commented May 6, 2013 at 14:57

1 Answer 1

5

Pretty simple:

If you don't need to include Template Priorities in your logic (doesn't look like you do):

ComponentLink link = new ComponentLink(publicationId);
string url = link.GetLink(componentId).Url;

If you do need to take template priorities into account:

ComponentLink link = new ComponentLink(publicationId);
string url = link.GetLink(currentPageId, componentId, componentTemplateToExclude, linkTagAttributes, linkText, textOnFail, showAnchor).Url;
1
  • Thanks Nuno, It was very helpful your answer. I fixed my problem. Thanks again.
    – ITB
    Commented May 7, 2013 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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