How to get only file names from sharepoint using any API's and c#

279 views Asked by At

I am trying to get only existing file names list with respected date and time from SharePoint using any API and C#.

I am able to download and upload files from SharePoint using webclient, but i am not able to get only file names list with respected date and time to datagridview. Please let me know if there is any solution for that.

I am developing in windows forms application using visual studio environment.

Thanks,

1

There are 1 answers

3
Saravanan On

Please try the c# code below to get the information about the files in directory

class FileSysInfo
{
    static void Main()
    {
        // Get the files in the directory and prints out filename, Last access time and length

        System.IO.FileInfo[] fileNames = dirInfo.GetFiles("*.*");


        foreach (System.IO.FileInfo fi in fileNames)
        {
            Console.WriteLine("{0}: {1}: {2}", fi.Name, fi.LastAccessTime, fi.Length);
        }
   }
}