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>
                                   <p>@folder.shortDescriptionOfTheDocument</p>                    
                                                  
                                   <div class="thinline"> </div>     
                                }
 }
               
               

}



 3) Insert the Macro in to a Template

Comments

Popular posts from this blog

Umbraco - Reset the Admin Password via SQL Server

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

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version