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!!

  • Welcome to Tridion Stack Exchange. What you tried so far? Are you referring to C# or Dreamweaver? – Siva Charan May 6 '13 at 14:57
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;
| improve this answer | |
  • Thanks Nuno, It was very helpful your answer. I fixed my problem. Thanks again. – ITB May 7 '13 at 7:04

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.