Create.MyFiles.File

Creates one or more files in either "My web files" or "My private files" area of eportfolio.

Input parameters:

Name

Description

Type

M/O

Message Type

Type of the message

Set to "MyFiles.CreateFile"

M

SyncKeys

One or more external SyncKeys for the created file(s).

Text

O

SiteId

Site where action will be executed

Int

O

VendorId

VendorId which will be associated with created content

Text

O

UserID

UserID of the owner.

Integer

O/M

UserSyncKey

User SyncKeyID of the owner.

Text

O/M

Visibility

If the file is to be added to either:

"Public" -> "My web files".

"Private" -> "My public files".

Text

"Private" or "Public"

M

ParentSyncKey

SyncKey of the folder into which the file is to be added. Default is the root.

Text

O

File


Name of the file(s).

Text.

Must not be blank.

Follow same rules as the UI. Can’t contain invalid characters

M

Notes:

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

Output

Finished status

If the folder was created successfully, output message contains its path, that can be used to construct URL for accessing the folder from web browser.

  • For private folders: returns relative physical path to new folder, for example "\myfiles\newfile".

  • For public folders: returns relative URL address to new folder, for example "/data/1/1/myfiles/newfile".

Warning status

  • Unable to find some files in the user's site.

  • File doesn't exist.

  • Supplied SyncRefId not found.

Errors status

  • Unable to find any files in the user's site.

  • Invalid format / parameters (different to specified schema).

  • User with specified UserId/UserSyncKey is not valid.

  • User with specified UserId/UserSyncKey is deleted.

  • User with specified UserId/UserSyncKey is external.

  • Folder related to ParentSyncKey has been deleted or removed.

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

  • Unable to find file matching the supplied GUID.

  • Message contains duplicates for syncKeys: {0}. Make sure your syncKeys are globally unique.

  • File name is blank or contains invalid characters.

  • File size exceeds the user's quota.

Sample database content

This section describes example output after successfully creating a new folder.

Conditions

Folder hierarchy: parent_folder > new_file

Private files physical folder for a given user: C:\itsl\dataprivate\1\1

Web files virtual folder for a given user: /data/1/1/

Web files homepage link: https://localhost/data/1/1

Storage

This is how it's being stored in the database:

MessageIdentifierMap

Folder visibility

EntityIdentifier

Type

Description

Private

\parent_folder\new_file

PrivateFolder

EntityIdentifier contains physical path suitable to use with PersonalFileHandler class. In code we handle physical paths, so its easier to store it this way. Pair EntityIdentifier and Type is an unique identifier.

Web

PublicFolder

MessageLogEntry

Folder visibility

EntityIdentifier

Description

Text

Description

Private

\parent_folder\new_file

Physical path suitable to use with PersonalFileHandler class. In code we handle physical paths, so its easier to store it this way.

\parent_folder\new_file

Physical path used to construct URL to a file in the user's private folder.
Sample URL used to navigate to the private folder: https://localhost/FileExplorer/BrowseFiles.aspx?Path=\parent_folder\new_file

Web

/data/1/1/parent_folder/new_file

Relative URL used to construct full URL to a file in the user's public folder.

Sample URL used to navigate to the public folder: https://localhost/data/1/1/parent_folder/new_file

MessageIndexEntry

Folder's SyncKey specified in the message

Type

Value

Description

Existing SyncKey

No changes

No changes to existing row

Not specified - null value

SyncKey

e9f3bc22-d307-48a0-8b4e-0934180df3a4

A row with autogenerated key is being inserted to the table

XML

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: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="CreateMyFilesFile" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<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="Visibility" minOccurs="1" maxOccurs="1" type="xs:string" />
</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="ParentSyncKey" 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
<Message xmlns="urn:message-schema">
<SyncKeys>
<SyncKey ID="ID1">123</SyncKey>
<SyncKey ID="ID2">456</SyncKey>
</SyncKeys>
<CreateMyFilesFile>
<UserSyncKey>123456</UserSyncKey>
<Visibility>Public</Visibility>
</CreateMyFilesFile>
<Files>
<File ParentSyncKey="789" SyncKeyRef="ID1">312a10a2-a79c-4d9e-ba11-697b85eea65f</File>
<File ParentSyncKey="789" SyncKeyRef="ID2">505d5e1c-62c5-4491-aeef-81c351f7dd2e</File>
</Files>
</Message>