Hi,
In my Provider Hosted app built on asp.net mvc 5, I am uploading attachments to document library by itemId. Now I need to display the files based on itemId on the Razor view with a "delete" option with each file so that user can delete desired file. I am getting the list of files by itemId in my method but no idea how to design and display on Razor view. Please help me out of this. Here is the method-
public List<string> getFiles(ClientContext clientContext, int ItemId)
{
List<string> docName = new List<string>();
if (clientContext != null)
{
Web spWeb = clientContext.Web;
List docLibrary = spWeb.Lists.GetByTitle("Documents");
Microsoft.SharePoint.Client.CamlQuery query = new Microsoft.SharePoint.Client.CamlQuery();
query.ViewXml = "<View>"+ "<Query>"+ "<Where><Eq><FieldRef Name='Request_ID'/><Value Type='Number'>" + ItemId + "</Value></Eq></Where>"+ "</Query>"+ "</View>";
ListItemCollection iles = docLibrary.GetItems(query);
clientContext.Load(files);
clientContext.ExecuteQuery();
foreach(ListItem doc in files.ToList())
{
docTitle.Add(doc["FileLeafRef"].ToString());
}
}
return docName.ToList();
}