Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Not able to get the file name from sharepoint . But able to get the object from it

(0) ShareShare
ReportReport
Posted on by 30

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.

pastedimage1674124351877v1.pngpastedimage1674124773483v1.png

  • Suggested answer
    Naveen Ganeshe Profile Picture
    3,393 User Group Leader on at
    RE: Not able to get the file name from sharepoint . But able to get the object from it

    Good to know that, You cracked this

  • Suggested answer
    Anoop B Profile Picture
    30 on at
    RE: Not able to get the file name from sharepoint . But able to get the object from it

    Worked fine like this!

    pastedimage1674136388610v1.png

  • Naveen Ganeshe Profile Picture
    3,393 User Group Leader on at
    RE: Not able to get the file name from sharepoint . But able to get the object from it

    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"]);
        }
    }
    


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 61 Most Valuable Professional

#3
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans