Create.Course.Element.Instance

This method will add a library content into course. Content 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.

Action

This type of message will add a library content into course. The element can be added to the course root folder or another folder within a course. Each 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 element instance.

Input Parameters

Name

Description

Type

M/O

Message Type

Text. "CreateCourseElementInstance"

M

SyncKey

External SyncKey for the created content.

Text

O

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 in he course.

Text

O

UserID

UserID of the creator.

Integer

O/M

UserSyncKey

User SyncKeyID of the creator.

Text

O/M

ContentId

Identifier of previously created content in library

Integer

O/M

ContentSyncKey

SyncKey of previously created content in library

Text

O/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.Either ContentId or ContentSyncKey must be specified. This means you should specify one.

Scenario

Use Create.Extension.Instance method to populate library, then take Content identifier from output of the method and use it in Create.Course.Element.Instance to add library content into course.

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

Schema

Create Course Link 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" type="MessageType"/>
<xs:complexType name="MessageType">
<xs:sequence>
<xs:element name="SyncKeys" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="CreateCourseElementInstance" type="CreateCourseElementInstanceType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SyncKeysType">
<xs:sequence>
<xs:element name="SyncKey" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreateCourseElementInstanceType">
<xs:sequence>
<xs:choice minOccurs="0" 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:choice minOccurs="1" maxOccurs="1">
<xs:element name="ContentId" type="xs:integer"/>
<xs:element name="ContentSyncKey" type="xs:string"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:schema>

Message content example

<Message xmlns="urn:message-schema">
<CreateCourseElementInstance>
<CourseId>1</CourseId>
<UserId>2</UserId>
<ContentSyncKey>37e36eba-7c94-4875-a776-e64066b0c3df</ContentSyncKey>
</CreateCourseElementInstance>
</Message>

Output

Finished Status:

  1. If the instance was created successfully.

  2. Returns the ElementID and SyncKey of the element.

Error statuses:

  1. Message must contain valid UserId/UserSyncKey.

  2. User with specified UserId/UserSyncKey is not valid.

  3. User with specified UserId/UserSyncKey is external.

  4. User with specified UserId/UserSyncKey is deleted.

  5. Invalid content: user hasn't access to my library functionality.

  6. Message must contain valid CourseId/CourseSyncKey.

  7. Course is deleted.

  8. Course is external.

  9. Course is archived.

  10. Your security settings don't allow you to perform that operation. No valid Organisation found for course - (Course Id {ID}) {Title}

  11. Your security settings don't allow you to perform that operation. Please contact administration to grant you an access to {Title} organisation.

  12. Cannot find root folder for the course.

  13. ParentSyncKey cannot be found in the identifier map or is invalid.

  14. ParentSyncKey is not a folder.

  15. ParentSyncKey is not an element within the course.

  16. Folder related to ParentSyncKey has been deleted or removed.

  17. Message must contain valid ContentId/ContentSyncKey.

  18. Instance with specified ContentSyncKey does not exist.

  19. Instance with specified ContentId/ContentSyncKey does not exist or is deleted.

  20. Instance with specified ContentId/ContentSyncKey is not accessible for specified UserId/UserSyncKey.

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 below.

  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. CourseId or CourseSyncKey must be provided.

  7. Course must exist.

  8. Course must not be external.

  9. Course must not be deleted.

  10. Course must not be archived.

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

  12. If specified: ParentSyncKey must be a folder.

  13. If specified: ParentSyncKey must not be deleted.

  14. ContentId or ContentSyncKey must be provided.

  15. Content must exists.

  16. Content must be accessible by creator.

  17. Creator user must have access to my library functionality.

  18. Content must not be deleted.

  19. Consumer must have access to organisation where course is created.