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 | Integer | 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 |
ParentID | ID of the folder where the element is to be created. If not specified then create in root. This is a ID of a previously created folder in he course. | Integer | O |
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:
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
<?
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
:choice
minOccurs
=
"0"
maxOccurs
=
"1"
>
<
xs
:element
name
=
"ParentId"
type
=
"xs:integer"
/>
<
xs
:element
name
=
"ParentSyncKey"
type
=
"xs:string"
/>
</
xs
:choice>
<
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
- If the instance was created successfully.
- Returns the ElementID and SyncKey of the element.
- Message must contain valid UserId/UserSyncKey.
- User with specified UserId/UserSyncKey is not valid.
- User with specified UserId/UserSyncKey is external.
- User with specified UserId/UserSyncKey is deleted.
- Invalid content: user hasn't access to my library functionality.
- Message must contain valid CourseId/CourseSyncKey.
- Course is deleted.
- Course is external.
- Course is archived.
- Your security settings don't allow you to perform that operation. No valid Organisation found for course - (Course Id {ID}) {Title}
- Your security settings don't allow you to perform that operation. Please contact administration to grant you an access to {Title} organisation.
- Cannot find root folder for the course.
- ParentSyncKey cannot be found in the identifier map or is invalid.
- ParentSyncKey/ParentId is not a folder.
- ParentSyncKey/ParentId is not an element within the course.
- Folder related to ParentSyncKey/ParentId has been deleted or removed.
- Message must contain valid ParentId.
- Message must contain valid ContentId/ContentSyncKey.
- Instance with specified ContentSyncKey does not exist.
- Instance with specified ContentId/ContentSyncKey does not exist or is deleted.
- 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:
- Input matches the schema below.
- Check the SyncKey is unqiue.
- User must exist.
- User must not be external. Check the flag (external_user_id and external_customer_id for user created AICC).
- User must not be deleted.
- CourseId or CourseSyncKey must be provided.
- Course must exist.
- Course must not be external.
- Course must not be deleted.
- Course must not be archived.
- If specified: ParentId must be the ID of a folder within the course.
- If specified: ParentId must be a folder.
- If specified: ParentId must not be deleted.
- If specified: ParentSyncKey must be the SyncKey of a folder within the course.
- If specified: ParentSyncKey must be a folder.
- If specified: ParentSyncKey must not be deleted.
- ContentId or ContentSyncKey must be provided.
- Content must exists.
- Content must be accessible by creator.
- Creator user must have access to my library functionality.
- Content must not be deleted.
- Consumer must have access to organisation where course is created.