Create.Course.Element.Page

This method will a create page extension element within a course and populate it with content. The page is created under a specified parent folder in the course. If parent folder is not specified, then by default it will be placed under the course root folder.

Note that "Page" is implemented as an itslearning extension, and requires the main content to be submitted according to a specific XML schema, and not pure HTML.

Files to be referenced within content blocks defined in this schema must also be treated slightly differently to links within "simple" rich content.

Action

This type of message will create a page in a course. The page element can be added to the course root folder or another folder within a course. Each page element should have a unique SynchKey associated with it up to the size of 128 characters.

A UserId or UserSyncKey needs to be specified which identifies the user who created the link.

Input Parameters

Name

Description

Type

M/O

SyncKey

External SyncKey for the created content.

Text

M

SiteId

Site where action will be executed

Int

O

VendorId

VendorId which will be associated with created content

Text

O

CourseID

ID of the course where the element is to be created.

Integer

O/M

CourseSyncKey

SyncKeyID of the course where the element is to be created.

Text

O/M

ParentSyncKey

SyncKey of the folder where the element is to be created. If not specified then create in root.This is a SyncKey of a previously created folder int he course.

Text

O

UserID

UserID of the creator.

Integer

O/M

UserSyncKey

User SyncKeyID of the creator.

Text

O/M

Title

Page title in itslearning

Text. Must not be blank. Must follow same rules as UI

M

Content

Page content in XML format corrensponding to the page extension format

XML

M

Notes:Either CourseID or CourseSyncKey must be specified. This means specify at least one is mandatory.Either UserID or UserSyncKey must be specified. This means specify at least one is mandatory.

Scenario

In order to create a course page element, a user needs to add a message with type corresponding to action Create.Course.Element.Page.

Result of that message processing can be acquired using GetMessageResult method with message identifier as an input parameter.

Message Schema

Create Course Element Page Schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:message-schema" elementFormDefault="qualified" targetNamespace="urn:message-schema">
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="SyncKeys" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="SyncKey" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CreateCourseElementPage" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="CourseId" type="xs:integer" />
<xs:element name="CourseSyncKey" type="xs:string" />
</xs:choice>
<xs:element name="ParentSyncKey" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="UserId" type="xs:integer" />
<xs:element name="UserSyncKey" type="xs:string" />
</xs:choice>
<xs:element name="Title" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Content" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Message content example

<Message xmlns="urn:message-schema">
<CreateCourseElementPage>
<CourseId>1</CourseId>
<UserId>1</UserId>
<Title>New migration toolkit page (tulips and desert)</Title>
<Content>
<PageContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ContentBlockSets>
<ContentBlockSet>
<ContentBlockText>
<Title>My content block</Title>
<Text>&lt;p&gt;test2&lt;/p&gt;&lt;p&gt;&lt;img alt=&quot;Desert&quot; border=&quot;0&quot; src=&quot;ITSLFileID=1&quot; style=&quot;padding: 5px 5px;&quot;/&gt;&lt;/p&gt;</Text>
</ContentBlockText>
<FileContents>
<FileContent>
<FileId>1</FileId>
<Location>6aa84a06-38f7-4f06-bc31-b8e005065218</Location>
<Name>Desert.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
</FileContents>
</ContentBlockSet>
<ContentBlockSet>
<ContentBlockText>
<Title>2nd text content block</Title>
<Text>&lt;p&gt;2nd&lt;/p&gt;&lt;script&gt;alert('hello')&lt;/script&gt;</Text>
</ContentBlockText>
<FileContents />
</ContentBlockSet>
<ContentBlockSet>
<ContentBlockFiles>
<Title>MyFiles block</Title>
<RootFolder>
<Title>Root folder title which will be ignore</Title>
<Files>
<File>
<Id>6</Id>
</File>
</Files>
<Folders>
<Folder>
<Title>No files inside</Title>
<Files></Files>
<Folders />
</Folder>
<Folder>
<Title>Tulips</Title>
<Files>
<File>
<Id>2</Id>
</File>
</Files>
<Folders>
<Folder>
<Title>Desert in tulips</Title>
<Files>
<File>
<Id>3</Id>
</File>
</Files>
<Folders />
</Folder>
<Folder>
<Title>Tulips in tulips</Title>
<Files>
<File>
<Id>4</Id>
</File>
</Files>
<Folders />
</Folder>
</Folders>
</Folder>
</Folders>
</RootFolder>
</ContentBlockFiles>
<FileContents>
<FileContent>
<FileId>1</FileId>
<Location>fd25bcc4-ccae-4b8d-87b4-4ed511d849b0</Location>
<Name>Tulips.jpg</Name>
<ContentType>application/octet-stream</ContentType>
</FileContent>
<FileContent>
<FileId>2</FileId>
<Location>31cc02c0-67a3-4b28-80f1-d95b9cdcedfe</Location>
<Name>Tulips.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
<FileContent>
<FileId>3</FileId>
<Location>6aa84a06-38f7-4f06-bc31-b8e005065218</Location>
<Name>Desert.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
<FileContent>
<FileId>4</FileId>
<Location>31cc02c0-67a3-4b28-80f1-d95b9cdcedfe</Location>
<Name>Tulips.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
<FileContent>
<FileId>5</FileId>
<Location>6aa84a06-38f7-4f06-bc31-b8e005065218</Location>
<Name>Desert.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
<FileContent>
<FileId>6</FileId>
<Location>6aa84a06-38f7-4f06-bc31-b8e005065218</Location>
<Name>Desert.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
</FileContents>
</ContentBlockSet>
<ContentBlockSet>
<ContentBlockImages>
<Title>Desert and tulips images</Title>
<Images>
<BlockImage>
<Title>Desert</Title>
<File>
<Id>1</Id>
</File>
</BlockImage>
<BlockImage>
<Title>Tulips</Title>
<File>
<Id>2</Id>
</File>
</BlockImage>
</Images>
</ContentBlockImages>
<FileContents>
<FileContent>
<FileId>1</FileId>
<Location>6aa84a06-38f7-4f06-bc31-b8e005065218</Location>
<Name>Desert.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
<FileContent>
<FileId>2</FileId>
<Location>31cc02c0-67a3-4b28-80f1-d95b9cdcedfe</Location>
<Name>Tulips.jpg</Name>
<ContentType>image/jpeg</ContentType>
</FileContent>
</FileContents>
</ContentBlockSet>
</ContentBlockSets>
</PageContent>
</Content>
</CreateCourseElementPage>
</Message>

Validation Rules

Before message is processed the MigrationProcessor will validate the message content and state of objects referred in it. These are validation rules:

  1. Input matches the schema above (content needs to match pages content schema).

  2. Check the SyncKey is unqiue.

  3. User must exist.

  4. User must not be external. Check the flag (external_user_id and external_customer_id for user created AICC).

  5. User must not be deleted.

  6. Course must exist.

  7. Course must not be external.

  8. Course must not be deleted.

  9. If specified: ParentSyncKey must be the SyncKey of a folder within the course.

  10. If specified: ParentSyncKey must be a folder.

  11. If specified: ParentSyncKey must not be deleted.

  12. Consumer must have access to organisation where course is created. Your security settings doesn't allow you to perform that operation. Please contact administration to grant you an access to {HieararchyName} organisation.

Handling files within Page content blocks

For more details on how to handle file links within Page content blocks, please see Handling rich content and files

Page content XML schema

Page content XML is extension specific description of content which should be created.

Please note that this schema is for information only, it's not taken into consideration when the message is validated during submission to the web service.

Page Content Schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:element name="PageContent">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ContentBlockSets">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="ContentBlockSet">
<xsd:complexType>
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:element name="ContentBlockImages" type="ContentBlockImageType" />
<xsd:element name="ContentBlockFiles" type="ContentBlockFileType" />
<xsd:element name="ContentBlockLinks" type="ContentBlockLinksType" />
<xsd:element name="ContentBlockText" type="ContentBlockTextType" />
</xsd:choice>
<xsd:element minOccurs="0" maxOccurs="1" name="FileContents">
<xsd:complexType>
<xsd:sequence minOccurs="0">
<xsd:element maxOccurs="unbounded" name="FileContent">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="FileId" type="xsd:unsignedByte" />
<xsd:element minOccurs="1" maxOccurs="1" name="Location" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="Name" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="ContentType" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
 
<xsd:complexType name="ContentBlockTextType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Text" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xs:complexType name="ContentBlockImageType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Images">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="BlockImage">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="File">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Id" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xs:complexType>
<xsd:complexType name="ContentBlockLinksType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Links">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="BlockLink">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="Url" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- Represent single file in folder -->
<xsd:complexType name ="FileType">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Id" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
 
<!-- Represent single folder in contentBlockFiles (CAN CONTAINS OTHER FOLDERS) -->
<!-- If type is used as root folder title is ignored -->
<xsd:complexType name="FolderType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Files">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="File" type="FileType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" maxOccurs="1" name="Folders">
<xsd:complexType>
<xs:sequence>
<xsd:element minOccurs ="0" maxOccurs="unbounded" name="Folder" type="FolderType"></xsd:element>
</xs:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
 
<xsd:complexType name="ContentBlockFileType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="RootFolder" type="FolderType" />
</xsd:sequence>
</xsd:complexType>
 
</xs:schema>