SharePoint lists and libraries can be exported to Excel using a out-of-box functionality, but unfortunately SharePoint may present an error message like: To export a list you must have a Microsoft SharePoint Foundation-compatible application.
Putting it in simple words, it’s requiring that you must use Internet Explorer to export the list or you must update your SharePoint site (through a KB or a complete version change) because you are probably using a browser like Chrome or Firefox. . But let’s assume that you don’t have time for that and just want to have the file at that moment? Then we have a quick tip for you! So you finally will get rid of those messages “microsoft sharepoint foundation compatible application” blah blah blah.
Sometimes we have to query a SharePoint list through remote connections using C#. It can happen in a SharePoint App, a Console Application or maybe on an Azure Function. This post will help on performing list operations with CSOM and C# in SharePoint.
Below you can find some code snippets that will help you on integrating SharePoint lists with your application.
Basically, you will have to add the Microsoft.SharePoint.Client namespace.
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
The required DLLs for programming these type of solution are:
After adding these references to our project, we can start coding and accessing the data in the SharePoint List you want!
Soon you will notice that everything depends on the ClientContext object, which manages the requests and the data that will be loaded.
In our examples we are going to use the variable siteUrl, that represents the URL for the Site Collection. The variable listTitle will also be used and it represents the Title of the list being used.
I believe these are the basics for consuming SharePoint lists. In the future I’m planning to show some complex examples, more focused on Office 365 and Azure integrations. Thanks for reading and I hope it can be useful to you when you need to perform list operations with CSOM and C# in SharePoint.
Wiliam is from Porto Alegre, Brazil, currently working as DevOps Engineering Advisor at Dell EMC. He has been working with Microsoft technologies for almost ten years with one year gap studying abroad in Japan attending the Science without Borders program from the Brazilian government. Also he is MCSE Productivity, a SharePoint lover.
Nowadays he is investing the most part of his time on exploring GitLab and Azure DevOps features and helping the company to develop a DevOps culture among its colleagues.
In addition of that, he spends some time on learning Japanese, doing CrossFit and playing real-time strategy games like Age Of Empires. Read More…
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Recent Comments