How to get App data from sharepoint online using csom c# RRS feed

  • Question

  • Hi,

    I want to download all Apps( Calendar, Task, Forms, Contacts, Announcements, etc) from SharePoint online using CSOM C#.

    Previously, I am iterating through each list and then iterating through each folders to get files. Below is my code

       foreach (List listItem in web.Lists)
                    var rootFolder = listItem.RootFolder;
       private void BackupFoldersAndFiles(Folder rootFolder)
        clientContext.Load(rootFolder, folder => folder.Files, folder => folder.Folders);
        foreach (var folder in rootFolder.Folders)

        foreach (var file in rootFolder.Files)
         // Downloading the file by opening the stream

    The problem is that if the list is app means other than document library, this code download only  .aspx files but not events for Calendar App , tasks for Task App which  I want to get. Please suggest me the way how to get it.


    Palak Jain

    Wednesday, November 23, 2016 2:22 PM

All replies

  • First what is the purpose of the downloading these app contents? You are right on the lists, list items are not files, you need to handle it differently. If you want these in some file format, then you need to explicitly create the file like csv, txt etc. and then write the item contents in to that file using your script.

    Rajesh| @rjesh
    You don't need to buy me a beer, if helpful just smile, vote, and mark it as answer.

    Wednesday, November 23, 2016 2:35 PM
  • Hi Rajesh,

    Am just trying if I can copy the apps to a different site and retain their data. For example, I want to copy my calendar events from one site to another.


    Wednesday, November 23, 2016 3:24 PM
  • for list items there are no specific files: if you want to backup them you need to iterate through all items, then for each item iterate through all fields and store value of each field in some format (e.g. into the file on local file system). But most probably simpler way will be to export data to Excel: How to back-up a Office 365 SharePoint Online site and data. If you use complex field types (e.g. taxonomy fields) then consider using some migration tool, e.g. Sharegate Migration tool.

    Blog -
    Dynamic CAML queries via C# -

    Wednesday, November 23, 2016 4:37 PM
  • Hi Palak,

    We can using the OOB feature "Save list as template" to achieve it.

    Open your Calendar list, go to List Settings -> Save list as template.

    Then go to the list template gallery and download the file, then upload it in your another site, and create calendar app using this template.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Thursday, November 24, 2016 6:37 AM