Trying to get the file name which is already there in the sharepoint folder. The problem is ,I have to get all the files in the sharepoint folder. So trying to get the files and find the name from it. But could not acheive it. If anyone have any idea, Please suggest.
Good to know that, You cracked this
Worked fine like this!
Hi Anoop,
Please take a look at the sample from Microsoft to interact with Sharepoint:
learn.microsoft.com/.../sample-create-retrieve-update-delete-sharepoint-location-record
Also, You can follow the below code as well:
using (ClientContext clientContext = new ClientContext("https://yourtenant.sharepoint.com/sites/yourSite")) { SecureString passWord = new SecureString(); foreach (char c in "password".ToCharArray()) passWord.AppendChar(c); clientContext.Credentials = new SharePointOnlineCredentials("username", passWord); Web web = clientContext.Web; List list = web.Lists.GetByTitle("yourListTitle"); CamlQuery query = CamlQuery.CreateAllItemsQuery(); ListItemCollection items = list.GetItems(query); clientContext.Load(items); clientContext.ExecuteQuery(); foreach (ListItem item in items) { Console.WriteLine(item.FieldValues["FileLeafRef"]); } }
Siv Sagar
149
Super User 2025 Season 1
Muhammad Shahzad Sh...
61
Most Valuable Professional
Daivat Vartak (v-9d...
53
Super User 2025 Season 1