Doubt Browse through folders and download a document from GridView SharePoint.Client.dll

0

Well I'm having a big question using the SharePoint dll.

What to need if done: I will use SharePoint as a file repository, so I will develop an ASP page that will list the folders and share documents and make it available for download.

Doubt: I have already been able to download a file, but only the one specified in the url and also I can not in the batch between folders (Open the folders listed).

Code: Listing in GridView

    private void popular()
    {
        using (ClientContext clientContext = new ClientContext("https://NomeDaEmpresa.sharepoint.com/sites/SubPasta))
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Nome", typeof(string));
            dt.Columns.Add("Tamanho", typeof(string));

            SecureString passWord = new SecureString();

            foreach (char c in "Password".ToCharArray()) passWord.AppendChar(c);

            clientContext.Credentials = new SharePointOnlineCredentials(Email, passWord);

            Web web = clientContext.Web;

            List oList = clientContext.Web.Lists.GetByTitle("Documentos");

            clientContext.Load(oList);
            clientContext.Load(oList.RootFolder);
            clientContext.Load(oList.RootFolder.Folders);
            clientContext.Load(oList.RootFolder.Files);
            clientContext.ExecuteQuery();

            FolderCollection fcol = oList.RootFolder.Folders;
            foreach (Folder f in fcol)
            {
                dt.Rows.Add(f.Name.ToString(), f.Size.ToString());
            }

            GridView1.DataSource = dt;
            GridView1.DataBind();
    
asked by anonymous 08.07.2018 / 18:05

0 answers