This method will create a single discussion within a specified course, under a specified parent folder element (if parent folder element is not specified, the root folder element is used).

Input

Name

Description

Type

M/O

SyncKeys

Array of SyncKey for the created content.

Complex type - array of SyncKey

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 parent folder where the element is to be created. Default use root folder of the course.

Integer

O

ParentSyncKey

SyncKeyID of the parent folder where the element is to be created. Default use root folder of the course.

Text

O

UserId

UserID of the creator.

Integer

O/M

UserSyncKey

User SyncKeyID of the creator.

Text

O/M

Title

Title of the discussion.

Text

M

Description

Description for the discussion.

Text

O

Threads

Threads to add to the discussions

Thread

O

Thread

Name

Description

Type

M/O

Subject

Subject of the thread

Text

M

Text

Initial text of the thread

Text

M

Notes

  • Either UserID or UserSyncKey must be specified. This means specify at least one is mandatory.

  • Either CourseID or CourseSyncKey must be specified. This means specify at least one is mandatory.

  • Both ParentID and ParentSyncKey are optional. Possible use only one of them either ParentID or ParentSyncKey.

Scenario

In order to create a discussion element a user needs to add a message with type corresponding to action Create.Course.Element.Discussion.

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:simpleType name="SyncKeyType">
<xs:restriction base="xs:string" />
</xs:simpleType>
 
<xs:simpleType name="VendorIdType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="36"/>
</xs:restriction>
</xs:simpleType>
 
<xs:simpleType name="TitleType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
 
<xs:simpleType name="SubjectType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="64"/>
</xs:restriction>
</xs:simpleType>
 
<xs:complexType name="ThreadType">
<xs:sequence>
<xs:element name="Subject" type="SubjectType" />
<xs:element name="Text" type="xs:string" />
</xs:sequence>
</xs:complexType>
 
<xs:complexType name="MessageType">
<xs:sequence>
<xs:element name="SyncKeys" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="SyncKey" type="SyncKeyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SiteId" type="xs:int" minOccurs="0" />
<xs:element name="VendorId" type="VendorIdType" minOccurs="0" />
<xs:element name="CreateCourseElementDiscussion">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="UserId" type="xs:integer" />
<xs:element name="UserSyncKey" type="xs:string" />
</xs:choice>
<xs:choice>
<xs:element name="CourseId" type="xs:integer" />
<xs:element name="CourseSyncKey" type="xs:string" />
</xs:choice>
<xs:choice minOccurs="0">
<xs:element name="ParentId" type="xs:integer" />
<xs:element name="ParentSyncKey" type="xs:string" />
</xs:choice>
<xs:element name="Title" type="TitleType" />
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="Threads" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Thread" type="ThreadType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>

Message content example

 <Message xmlns="urn:message-schema">
     <SyncKeys>
         <SyncKey>SyncKey</SyncKey>
     </SyncKeys>
     <CreateCourseElementDiscussion>
         <CourseId>1</CourseId>
         <ParentId>2</ParentId>
         <UserId>1</UserId>
         <Title>Title</Title>
         <Description>Description</Description>
<Threads>
<Thread>
<Subject>Subject</Subject>
<Text>Text</Text>
</Thread>
</Thread>    
     </CreateCourseElementDiscussion>
 </Message>

Validations

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.

  2. SyncKey must be unique.

  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. Title must not exceed 255 characters.

  10. If specified: ParentID must be an element ID within the course.

  11. If specified: ParentID must be a folder.

  12. If specified: ParentID must not be deleted.

  13. If specified: ParentSyncKey must be an element ID within the course.

  14. If specified: ParentSyncKey must be a folder.

  15. If specified: ParentSyncKey must not be deleted.

  16. If specified: Subject of any thread must not exceed 64 characters.