PLATFORMS SOLUTIONS BLOGS CONTACT

/howto/sharepoint/documentmigration




SharePoint Document Migration


This section shows you how you can access SharePoint Document Lists, and how you can copy documents to/from Sharepoint Online.

The handlers of the SharePoint Adapter related to moving documents to/from SharePoint are limited to SharePoint Online. These methods contain the term MarkedDocument (ex: UploadMarkedDocuments).



This How To document shows you how you can:

  • Query SharePoint Document Libraries
    Read the content of a SharePoint Document Library, including specific folders.

  • Create a Document Library within a Sub Site
    Create a new Document Library that will hold documents.

  • Upload documents into the new Document Library
    Upload one or more documents into the Document Library and monitor the transfer.



The examples provided in this section require that the SharePoint adapter be configured with a SharePoint login account with sufficient rights to perform the various operations.


Query SharePoint Document Lists

Let's execute a query against SharePoint Online to retrieve the list of documents available in an existing Document Library, retrieving all files recursively. Querying Sharepoint Lists is normally done using the GetListItems handler; however you should call the GetDocuments handler for Documents Libraries.

EXEC Sharepoint.GetDocuments 'Documents', '', 1
SELECT * FROM Sharepoint.[Documents@Documents] WHERE recursive=1

The GetDocuments handler can also be called using the Documents table as seen above; using the SELECT command requires that the name of the Document Library be specified after the @ symbol.


Create a Document Library

Let's first create a new Document Library called TestDocs in the current Site in which we will also create a Folder.

EXEC sharepoint.CreateList 'TestDocs', 'DocumentLibrary', 'A test document library'

And let's create a folder within the library called txtfiles

EXEC sharepoint.createfolder 'TestDocs', 'txtfiles'

You can also create libraries in Sub Sites; for example if you would like to create a Document Library in the /Tech Sub Site, you would run this command instead:

EXEC sharepoint.CreateList '/Tech/TestDocs', 'DocumentLibrary', 'A test document library'


Upload One Document

To upload a single document into an existing Document Library, you can use the UploadDocument handler.

EXEC SharePoint.UploadDocument 
	'c:\tmp\WinningTest2.xlsx', -- the source file to upload
	'TestDocs',     -- the destination document library (you can specify subsites)
	'WinningTest2.xlsx' -- the new name in SharePoint (you can specify folders)

Once the operation is completed, you can access the document in SharePoint directly.

You can also upload TMP files that were previously downloaded into Enzo using the DownloadDocument handler.


Upload Multiple Documents

We will use the MarkedDocument feature to upload multiple documents into Sharepoint online, in the TestDocs library created previously.

The MarkedDocument feature in the Sharepoint adapter allows you to upload or download multiple documents as a background operation.

Let's make sure the MarkedDocument is empty:

EXEC sharepoint.ClearMarkedDocuments

Let's add a few local files to the MarkedDocuments internal list using the AddMarkedLocalFiles handler:

EXEC SharePoint.AddMarkedLocalFiles 'c:\tmp\firestations\*.*'
The c:\tmp\firestations\ folder contains 3 text files on my machine; you should change this path to a location that has a few files for testing purposes.

The above command will only work if you also have the BSC.Files adapter loaded in Enzo.

Let's run this command to inspect the files that have been marked:

SELECT * FROM sharepoint.MarkedDocuments

At this point you could continue adding files from other folders into the MarkedDocuments table. The processed column indicates whether the file has been processed and the txPct indicates how much of the file has been transferred (download or upload progress).

To upload these files into the previously created SharePoint Document list, in the txtfiles folder, execute this command:

EXEC sharepoint.UploadMarkedDocuments 'TestDocs', '/txtfiles'

The above handler is blocking in nature. You can open another connection to Enzo and SELECT from the MarkedDocuments table to inspect the file transfer status. Once completed, you can view the files in the TestDocs Document Library:

SELECT * FROM sharepoint.Documents@TestDocs WHERE recursive=1







601 21st St Suite 300
Vero Beach, FL 32960
United States

(561) 921-8669
info@enzounified.com
terms of service
privacy policy

PLATFORM

ENZO SERVER
ENZO DATAZEN

SOLUTIONS

SOLUTIONS OVERVIEW
INTEGRATION
SaaS
CLOUD ANALYTICS

RESOURCES

DOWNLOAD
BLOGS & VIDEOS
IN THE NEWS
ENZO ADAPTERS
ONLINE DOCUMENTATION
TCO CALCULATOR

COMPANY

LEADERSHIP TEAM
PARTNERS


© 2023 - Enzo Unified