Skip to main content

Notifications

Announcements

No record found.

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,392 Moderator 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,392 Moderator 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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

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

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans