Umbraco Razor - List Documents form Folder selected via the Media Picker

1) Create a Media Picker in your Document Type: "listFilesFromAParticularFolder"

 2) Create this Macro

@using Examine
@using Examine.SearchCriteria
@using UmbracoExamine
@using System.Xml.XPath

 if (@Model.listFilesFromAParticularFolder != "" && @Model.listFilesFromAParticularFolder != null)
                   dynamic imageFolder = Library.NodeById(@Model.listFilesFromAParticularFolder); 
                   <h2>Related Documents</h2>

                   foreach (var folder in imageFolder.Children)   
                                   <p>&bull; <a href="@folder.Url">@folder.Name</a> (@folder.umbracoExtension)</p>
                                   <div class="thinline"> </div>     


 3) Insert the Macro in to a Template


Popular posts from this blog

Umbraco Razor Sort Nodes Ascending or Descending

Umbraco Razor get Querystring

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco