BatchImport Sharepoint Blog Extension

Last modified by Admin on 2021/03/19 00:49

cogBatchImport extension allowing to import Sharepoint Blog exports.
TypeXAR
Category
Developed by

Ludovic Dubost

Active Installs4
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Compatibility

Testing on XWiki 5.4

Installable with the Extension Manager

Description

This extension to the BatchImport application allows to import Sharepoint blogs.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Here are the installations and usage instructions.

Export the Sharepoint Blog

In order to export the Sharepoint 2013 blog posts and categories you will need use Microsoft Access.
(More and better info and images to come).

1) Import to Microsoft Access

1.1) Open your Microsoft Access.
1.2) Create a local database
1.3) In "Extern Data" tab, choose "Sharepoint list"
access1.png

1.4) Point your blog address, for example (http://www.sharepointsite.com/yourblog)
1.5) choose to import the data to a new table
access2.PNG

1.6) Choose import Category and Posts
access3.PNG

1.7) Import the data.
1.8) IN the "Edit Mode" Exclude unnecessary columns ( You will need just the following columns: title, published date, category and body )
access4.PNG

2) Export the Post table (Excel or CSV)

2.1) In the tab "external Data", choose Txt Archive button
access5.PNG

2.2) Choose (;) as the separator character
2.3) Export the archive (try to maintain the following order of the tables |title| published date| category |body|
2.4) Open it in a text editor and save it as csv.
2.5) Open the csv file in the excel.
IMPORTANT
2.6) When you export the post table, the category column come with the ID category number. It will be necessary by hand to replace the id to the respective category name. You can take this information on the  "Category table" that was imported in the Microsoft Access.

2.7)Exclude unnecessary columns (if exists) imported in the Access that will be exported
2.8)Save the archive as xls or csv. See an example of the final product here: this file

3) Get blog set documents

3.1) Open you sharepoint site in IE (http://www.sharepoint.com)
3.2) Login as administrator
3.3) In the sharepoint menu, open the sharepoint site in the explorer mode
3.5) Look and find the sharepoint blog directory
3.5) Copy all content to your xwiki server.

The result of the export should be:

  • An xls or csv file. The result depends on the language of your interface and should look like this file (the example is an export coming out of a Brasilian/Portuguese Sharepoint installation).
  • A set of directories. In the case of the Brasilian/Portuguese installation the directory tree should contain at least the following directories
    • Documentos
    • Lists
    • Lists/Fotos

Copy the content to the server or computer on which your XWiki instance is installed. The server should be able to read that content, otherwise the file importing will fail.
You can try with the sample blogimport.zip file.

Install XWiki's BatchImport application

You will need to install the XWiki Batch Import application. To do this you need to first:

Install the Blog Batch Import

You then can install the Blog Batch Import using XWiki's Extension Manager.

Configure the BlogBatchImport for your use case

You will need to modify the Blog Batch Import to be able to be used for your configuration. You will need to change the following things:

Modify the BlogBatchImportGroovy script

For this edit the Blog.BlogBatchImportGroovy page in Wiki mode. You will find the following lines in this script:

// THINGS TO CONFIGURE ARE HERE
// name of categorie field
def CATEGORY = "Categoria"

// prefix for files and images
def PREFIX = "prefix"

def WEBSITEURL = "http://blogbatchimport.xwiki.org"

// END THINGS TO CONFIGURE
  • The first setting is the Sharepoint blog property name used for Categories. It depends on the language of your installation. 
  • The second setting is the name of the url path where files and images are found. This is necessary to properly identify URL links representing images and files available in the export
  • The third setting is the URL of your old server or any URL you would like to use to prefix any relative link found in the articles. These links correspond to links towards other content of Sharepoint which are not files and attachments of the blog. By prefixing it by a server you control you can then setup redirects in your server to point to the right place where you content is or will be.
    Depending of your SO and archive language, Maybe, it will be necessary to change the method "convertFileName". In case of pt_BR, the change was:

public convertFileName(filename) {
       int index = filename.lastIndexOf("/")
       return filename.replaceAll("\\+", " ");
       // return filename.substring(0, index + 1) + java.net.URLEncoder.encode(filename.substring(index + 1), "iso-8859-1").replaceAll("\\+", " ").replaceAll("%28", "(").replaceAll("%29", ")");;
}

Once you have mande modifications to this page you need to activate it by visiting the page Blog.BlogBatchImportGroovyInstall

Set the data directory in the BlogBatchImport page in editobject mode

Visit the the Blog.BlogBatchImport in "edit object" mode. You will find the "edit object" link in the edit drop down menu if you have the "Advanced User" setting  (change this setting in your profile preferences). Alternatively append "?editor=object" to the edit page of the  Blog.BlogBatchImport page.

On this screen you need to edit the "datafilename" field and point it to the directory where the wiki can find the extracted content of your Sharepoint content. The files should be copied over to where you XWiki instance is installed.

blogimport_directorysettings.png

Use the BlogBatchImport

Start

Visit Blog.BlogBatchImport. On this screen you will see that you can select the sample BlogContent.xls (corresponding to the files and images in the sample blogcontent.zip) or select your own XLS file after importing it.

blogimport_start.png

Settings

On the settings screen, you will need to change the setting if the language of your Sharepoint installation is not portuguese. Assign the right fields from your excel file to the right XWiki fields. Additionally you need to set the default date (otherwise your dates won't be properly converted). The value to set is (with white spaces between each date item and colon between each time item):

dd MM yyyy HH:mm:ss

You can see the result on the following screenshot:

blogimport_settings.png

Preview Import

The next screen will allow you to preview the import. You should get something in every field, except for the "Attachments" field which is empty for some lines, but has some values for other. It's important to verify that the page name and title is correct, that you get something in the page content, that you can see the categories and that the date is showing something valid.

blogimport_preview.png

Choose Data Duplication Setting

On the data duplication setting screen it's important to choose "Generate" for the first option and "Update" for the second.
The first option will tell the importer how to handle articles that have the same title. The second option is only important when you re-run the importer a second time.

blogimport_dataduplication.png

Import Simulation

On the next screen you should see the result of the import simulation. In particular this will check that the attached files or images are found on the disk. If you get errors on this screen this will probably mean the directory is not set properly for the tool to find the files. Check in the settings section.

blogimport_simulation.png

Final Import Screen

On the final import screen you get to verify that everything went fine. The result should look like this:

blogimport_final.png

Import Result

You can see the import result on the home page of the Blog Blog.WebHome

As you can see the categories are imported (as you can see the number of articles per category) as well as the blog content and images.

blogimport_result.png

Get Connected