Ektron CMS400.NET API Documentation
|
Creates a new folder in the CMS. By default the new folder inherits subscription properties of parent folder. To override, use the BreakInheritance property of the FolderRequest.SubscriptionProperties object (set it to True).
See Also: The Example section.
public AddFolder(FolderRequest request);
Public Sub AddFolder(ByVal request As FolderRequest)
Parameters |
Description |
request |
The Folder's properties as a FolderRequest object. |
The following example shows how to create a Web page from which a folder can be added to CMS400.NET. This example uses some standard drag and drop controls and a small section of VB code utilizing the AddFolder method. This method uses the InternalAdmin to add the folder. In the first section, we will deal with the standard drag and drop controls. In the second, we'll deal with the code behind.
1. Between the form tags, add the following label: <asp:Label ID="Label1" runat="server" Text="Folder Name: " Width="84px"></asp:Label> 2. Add a text box to enter the folder's name. <asp:TextBox ID="txtFolderName" runat="server" Width="96px"></asp:TextBox> 3. From the Validation control menu, add a RequiredFieldValidator control. This validates that something appears in the Folder Name box. <asp:RequiredFieldValidator ID="rfvFolderName" runat="server" ControlToValidate="txtFolderName" ErrorMessage="Please enter folder name"></asp:RequiredFieldValidator> 4. Add a couple of breaks for spacing purposes. <br /><br /> 5. Add a label for the description box. <asp:Label ID="Label2" runat="server" Text="Description: " Width="72px"></asp:Label> 6. Add a text box to enter a description. <asp:TextBox ID="txtDescription" runat="server" Width="358px"></asp:TextBox> 7. Add two more breaks for spacing purposes. <br /><br /> 8. Add a button to submit the information. We will set the button click event in the code behind. <asp:Button ID="btnAddFolder" runat="server" Text="Add CMS Folder" Width="110px" /> 9. Add two last breaks. <br /><br /> 10. Add a results label that lets a user know if the add succeeded. <asp:Label ID="lblResult" runat="server" Width="545px"></asp:Label>
Add the following information to the code behind of your aspx.vb page.
Protected Sub btnAddFolder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddFolder.Click
Dim folderApi As New Ektron.Cms.API.Folder
Try Dim req As New Ektron.Cms.FolderRequest req.FolderName = txtFolderName.Text req.FolderDescription = txtDescription.Text req.ParentId = 0 'Add this folder under the root folder in the Workarea req.StyleSheet = "" folderApi.AddFolder(req)
Dim newFolderID As Integer = req.FolderId lblResult.Text = "Folder " & txtFolderName.Text & " was added under the root folder in the Workarea with FolderID = " & newFolderId.ToString()
Catch ex As Exception lblResult.Text = ex.Message End Try End Sub
Copyright (c) 2008. All rights reserved.
|
What do you think about this topic? Send feedback!
|