Documentation > CMS Template API Library > Asset > GetLastPublishedLinks(Boolean,ProtocolType)

GetLastPublishedLinks

Returns the last published link(s) of the asset or the binary file based on the current context and current publishing server. This API call can be used in the output.aspx or post_publish.aspx to return the last published urls of the loaded asset. If there is no output or post publish context available, it returns the last published urls based on all the current publishing servers.

public System.Collections.Generic.List GetLastPublishedLinks(Boolean,ProtocolType)



Parameters

NameDescriptionType
addDomain

Optional: If true add HostName for current publishing package to link. Defaults to false.

System.Boolean
protocolType

Optional: If addDomain is true, determines if the protocol should be added and whether to use http or https. No effect in Preview.indexer

CrownPeak.CMSAPI.ProtocolType

Code Example

C#

Sample:
	  <% Asset binaryFile = Asset.Load("/Assets/1video.mp4");
      if (binaryFile.IsLoaded)
      {
        List<string> urls = binaryFile.GetLastPublishedLinks(true);
        foreach (string str in urls) Out.WriteLine(str);
      }
    %>

Connect with Crownpeak