Assuming you are creating a new control you put following into the markup:
<asp:DropDownList runat="server" ID="drpItems"/>
And following into the codebehind:
TreeProvider treeProvider = new TreeProvider(SiteContext.CurrentUser);
TreeNodeDataSet docs = DocumentHelper.GetDocuments("YourSite", "/%", "en-US", true, TreeProvider.ALL_CLASSNAMES, null, "DocumentName", TreeProvider.ALL_LEVELS, false, -1, "DocumentName, DocumentID", treeProvider);
foreach (TreeNode treeNode in docs)
{
drpItems.Items.Add(new ListItem
{
Text = treeNode.DocumentName,
Value = treeNode.DocumentID.ToString()
});
}
Adjust parameters of the DocumentHelper.GetDocuments()
methods - espcially siteName, nodeAliasPath and columns you want to select.
If you don't use workflow/versioning you can use SelectNodes()
method from the treeProvider. It has similar parameters and is more efficient for that case.