To be able to use XML data within a list or library the XML must be uploaded to SharePoint. Then the XML must be read.



After the file(s) are uploaded the user have to press the "done" button. This will redirect the user to a custom page which will process the uploaded files.
All XML files with the extension ".xml" will be processed.

The processing of the XML file will be as followed:
#. The XML is tranformed with a supplied XSLT. This XSLT can be assigned to the list where you upload the XML file.


When no XSLT is supplied, then the transformation will be skipped.

#. The XML is checked with the defined XML schema (which will validate the XML)

#. The tranformed XML is read and processed.

#. Import is done and the user can click the close button


Schema Definition
The schema can be found within the solution, the transformed (or uploaded) XML must comply with this schema in order to work.

How does it work
As the schema describes the XML needs to start with the "Properties" tag, within this tag you can specify as many "Field" tags as you like. These fields will represent the properties that needs to be set.

Each "Field" tag have its own childeren. It has to have a "Id" tag which will specif which property needs to be set. This can be the titlte of the field, internalname of the field or the Guid of the field.

Beneath the "Field" tag you can have a "Value" tag, which will represent a string, but it could also have a "Properties" tag.
This "properties" tag can only be used then the field you want to set is a lookup fieldtype. This will allow you to set properties wihtin the lookup list.

Each Field tag can have an attribute called "Unique", by default the value of the attribute is false, but when you set this attribute to true the processing will try to find an item based on the fields that are set to unique. This will allow you to update an item rather than to create a new item.


If you specify the contenttype or contenttypeid the item will be created based on that contenttype, when the contenttypeid is based on a folder a folder will be created.

Even document can be uploaded aswell. Within the same upload of the XML file the document needs to be uploaded. The XML must refer to the document in order to know which file needs to be used.
The "File" tag under the "Properties" tag needs to be used.

  • DocumentSet can not be created with this module, sandboxed solutions are not allowed to create document sets
  • The xml files need to have the ".xml" extension otherwise they will not be found
  • The user MUST click the done button in order to start the processing
  • Do not upload more then 10 XML files at once, sandboxed solution may not execute that long and an error could occur.
  • When a new subsite is created the site feature needs to be disabled and enabled again in order to have a temporary library
  • Remember that Fieldnames are casesensitive!

Last edited Oct 24, 2012 at 5:59 PM by bonm014, version 5


No comments yet.