简体   繁体   中英

GET data from SharePoint on-premise and POST data to SharePoint Online

I need to GET data from SharePoint Server 2019 (On-premise) list and then I need to add that data to the SharePoint Online list using CSOM.

I have found the below link to get data from SharePoint Server (On-premise) list. https://www.c-sharpcorner.com/article/sharepoint-client-object-modal-csom/

I have found below link to add data to SharePoint Online list. https://www.c-sharpcorner.com/blogs/create-a-list-item-in-sharepoint-using-csomannouncement-list

Is that correct way or do I need prefer another way?

Thanks

If you just need list data without any version history or created/modified user and time stamps - you can export the SharePoint on-premise list to excel and use this excel file to create/import a new list in SharePoint Online.

Other options are to

  1. Use Microsoft's "SharePoint Migration Tool" to migrate content - this is a free tool provided by Microsoft - https://docs.microsoft.com/en-us/sharepointmigration/introducing-the-sharepoint-migration-tool
  2. use CSOM code in a VS application as per the links you have - note that you don't need to create 2 separate applications for it, just create one app and create separate instances of the ClientContext for SP on-prem and SP online
  3. use PnP PowerShell to get all list items and then loop over each item and create each item in target SPO site OR use SharePoint Powershell module to do the same. Here is an example of a script that migrates documents but with some minor modification you can get it to work with list data - https://github.com/alimughalx/CopySharePointFilesWithMetaDataAndVersionHistory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM