---
title: Displaying SharePoint data on the live site
related:
  - https://docs.kentico.com/13/integrating-3rd-party-systems/integrating-sharepoint/configuring-sharepoint-integration-connections.md
  - https://docs.kentico.com/13/integrating-3rd-party-systems/integrating-sharepoint/displaying-sharepoint-data-on-the-live-site/example-displaying-a-sharepoint-picture-library.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you have data stored on a SharePoint Online server, Xperience enables you to retrieve this data and include it on your live site – you can display images and provide download links for files.

After you [configure a SharePoint integration connection](https://docs.kentico.com/13/integrating-3rd-party-systems/integrating-sharepoint/configuring-sharepoint-integration-connections.md), you can display SharePoint data using the API within the **CMS.SharePoint**  namespace:

1. In Visual Studio, open your project and navigate to where you want to display the data.
2. In the code, get an instance of a SharePoint service using a [configured SharePoint integration connection](https://docs.kentico.com/13/integrating-3rd-party-systems/integrating-sharepoint/configuring-sharepoint-integration-connections.md).

   ```csharp

   using System.Data;
   using CMS.SharePoint;

   // Use the code name of your SharePoint connection and the code name of your site
   SharePointConnectionInfo connectionInfo = SharePointConnectionInfoProvider.GetSharePointConnectionInfo("ConnectionCodename", "SiteName");

   ISharePointListService service = SharePointServices.GetService<ISharePointListService>(connectionInfo.ToSharePointConnectionData());

   ```
3. Retrieve a set of SharePoint data. To obtain the name of a SharePoint library, open your SharePoint server, go to the **Site Contents** tab and use the library name as specified in the **Name** column. Do not use the code name of a library from the _SharePoint_ application in the Xperience administration interface.

   ```csharp

   DataSet images = service.GetListItems("SharePointLibraryName");

   ```
4. Iterate through the data and retrieve URLs from the **FileRef** row using the **GetSharePointFileUrl** method.

   ```csharp

   SharePointUrlProvider sharePointUrlProvider = new SharePointUrlProvider(connectionInfo.SharePointConnectionName);

   foreach (DataRow row in images.Tables[0].Rows)
   {
       // Retrieves the URL of a piece of data, which you can now process, e.g. by passing it to a model
       string fileUrl = sharePointUrlProvider.GetSharePointFileUrl(row["FileRef"].ToString());

       // You can also access other available metadata
       string fileTitle = row["Title"].ToString()
   }

   ```
5. Use the retrieved URLs to display the content on your website (for example, use a model class to pass the URLs to a view).

If you want to see a sample implementation of a SharePoint integration, visit [Example - Displaying a SharePoint picture library](https://docs.kentico.com/13/integrating-3rd-party-systems/integrating-sharepoint/displaying-sharepoint-data-on-the-live-site/example-displaying-a-sharepoint-picture-library.md).
