Try our conversational search powered by Generative AI!

Linkitems in Linkitemcollection

Vote:
 

Hi everyone,

I have a specific question about the LinkItemCollection property. It holds the LinkItem objects of different types (internal links to pages, external links, email links, links to internal mediafiles etc.). The only property i can find is 'Href' which shows the link. How can i find out what type of link it was?

For instance a pdf file is shown as: /link/46c1ceba004c4d6b9f2fc2bd62c8650a.aspx

Same for internal links to pages.

I can use ' PermanentLinkMapStore.TryToMapped'  but this only is part of the solution. Anyone has a good solution for this? My end goal is that i can show Icons at my list of links which vary depending on the type of link.

Thanks in advance,

Ronald

#136919
Sep 18, 2015 10:50
Vote:
 

UrlResolver.Current.GetUrl(item.Href) should get you the "real" url. From that I guess you can look at extension etc to decide what icon to choose.

/Erik

#136922
Sep 18, 2015 11:19
Vote:
 

Thanks that already helps  me quite a bit!

#136934
Sep 18, 2015 12:50
Vote:
 

Oh, btw. If you want it as an IContent you can do UrlResolver.Current.Route(new UrlBuilder(item.Href)), then you could probably use the type instead.

#136951
Sep 18, 2015 13:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.