Deprecation notice

This API was built to create a file element of an old type. It is currently redirected to create a file element of a new type ("File or folder"), and over time we will deprecate this api. Please use Create.Extension.Instance File instead.


Creates one or many file elements within specified course, under specified parent folder element (if parent folder element is not specified root folder element is used). Uses inherited security from parent folder element. User specified in a content of the message is assigned as creator and owner of all created element. File element is a content placeholder for a course entity containing link to file, name, and comment.

Action

Message with that type will create file element(s) inside course. All elements will be added inside specified course and in one specific folder (course root folder or folder found using specified parent element id). Depending on Active parameter created elements should be active or inactive. Elements will be added by impersonation of the specified user. That user will become owner and creator of all created elements. All elements will inherit security settings from parent folder. Each element will have a name based on a name attribute specified on File element or file name referred in File element if name attribute is not specified. There is possibility to add comments to created elements through comment attribute on File element (it is optional).

Input parameters

Message

Name

Description

Type

M/O

SyncKeys

Array od SyncKey for the created content.

Complex type - array of SyncKey

O

SiteId

Site where action will be executed

Int

O

VendorId

VendorId which will be associated with created content

Text

O

CreateCourseElementFile

Main element

Complex type - CreateCourseElementFile

M

Files

List of files

Complex type - Files

M

SyncKey

Name

Description

Type

M/O

ID

Attribute

ID

M

Value

SyncKey value

Text

O

CreateCourseElementFile

Name

Description

Type

M/O

CourseId

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

Integer

O/M

UserSyncKey

User SyncKey of the creator.

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 the 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 the course.

Text

O

Active

Element active status

Boolean

O

UserId

UserId of the creator.

Integer

O/M

UserSyncKey

User SyncKey of the creator.

Text

O/M

Files

Name

Description

Type

M/O

File

File element

Text

M

File.Name

Attribute. File name

Text

O

File.Comment

Attribute. Comment

Text

O

File.SyncKeyRef

Attribute. Reference to id in SyncKey element.

IDREF

O

Notes

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

Scenario

In order to create file element user needs to:

  1. Upload desire file using UploadFile service.
  2. Add message with type corresponding to action Create.Course.File.Element

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

Schema


Message schema (updated release 46)
<?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:complexType>
<xs:sequence>
<xs:element name="SyncKey" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:ID" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SiteId" minOccurs="0" maxOccurs="1" type="xs:int" />
<xs:element name="VendorId" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="36"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreateCourseElementFile" 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:choice minOccurs="0" maxOccurs="1">
<xs:element name="ParentId" type="xs:integer" />
<xs:element name="ParentSyncKey" type="xs:string" />
</xs:choice>
<xs:element name="Active" minOccurs="0" maxOccurs="1" type="xs:boolean" default="true"/>
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="UserId" type="xs:integer" />
<xs:element name="UserSyncKey" type="xs:string" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Files" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="File" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Name" type="xs:string" use="optional" />
<xs:attribute name="Comment" type="xs:string" use="optional" />
<xs:attribute name="SyncKeyRef" type="xs:IDREF" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>


Message content example

File Message content
<Message xmlns="urn:message-schema">
<SyncKeys>
<SyncKey ID="id0">bde4a751-da1c-424b-9daa-f890fd6033f0</SyncKey>
<SyncKey ID="id1">31537938-0667-4e82-be48-0672faad91a7</SyncKey>
<SyncKey ID="id2">b9294712-ca29-45c2-8d49-765f65f90673</SyncKey>
</SyncKeys>
<CreateCourseElementFile>
<CourseSyncKey>CourseSyncKey1</CourseSyncKey>
<ParentSyncKey>FolderSyncKey</ParentSyncKey>
<Active>false</Active>
<UserSyncKey>1</UserSyncKey>
</CreateCourseElementFile>
<Files>
<File Name="MyFileName0" Comment="My file comment0" SyncKeyRef="id0">dadbad56-909a-487f-a490-4694cf564230</File>
<File Name="MyFileName1" Comment="My file comment1" SyncKeyRef="id1">4ed5499c-53de-4a41-a1b5-cfeee59de2a0</File>
<File Name="MyFileName2" Comment="My file comment2" SyncKeyRef="id2">01138449-53dd-4392-bbb5-b9149c73365e</File>
</Files>
</Message>


Validations

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

  1. User must exist.
  2. User must not be external. Check the flag (external_user_id and external_customer_id for user created AICC).
  3. User must not be deleted.
  4. Course must exist.
  5. Course must not be external (check external_customer_id)
  6. Course must not be deleted.
  7. If specified: ParentSyncKey must be existing folder syncKey created using migration toolkit.
  8. If specified: ParentSyncKey must point to an element ID within the course.
  9. If specified: ParentSyncKey must point to a folder.
  10. If specified: ParentSyncKey must point to not deleted element.
  11. If specified: ParentId must point to an element ID within the course.
  12. If specified: ParentId must point to a folder.
  13. If specified: ParentId must point to not deleted element.
  14. File identifier must exist.
  15. File referred in a message must have been uploaded by the same 3rd party as making the call.