Ektron CMS400.NET API Documentation
|
Delete the folder by its ID.
See Also: The Example section.
public Boolean DeleteFolderById(Long Id);
Public Function DeleteFolderById(ByVal Id As Long) As Boolean
Parameters |
Description |
Id |
The folder's ID. |
False = successfully deleted. Otherwise, returns True.
The following example shows how to create a Web page from which a folder can be deleted from CMS400.NET by entering its ID. This example uses some standard drag and drop controls and a small section of VB code utilizing the DeleteFolderById method. This method uses the InternalAdmin to delete 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 ID: "></asp:Label> 2. Add a text box to enter the folder's ID. <asp:TextBox ID="txtFolderId" runat="server" Width="44px"></asp:TextBox> 3. From the Validation control menu, add a RequiredFieldValidator control. This validates that something appears in the Folder ID box. <asp:RequiredFieldValidator ID="rfvFolderId" runat="server" ControlToValidate="txtFolderId" ErrorMessage="Please enter folder ID"></asp:RequiredFieldValidator> 4. Add a couple of breaks for spacing purposes. <br /><br /> 5. Add a delete button. We will set the button click event in the code behind. <asp:Button ID="btnDeleteFolder" runat="server" Text="Delete Folder" Width="95px" /> 6. Add two more breaks for spacing purposes. <br /><br /> 7. Add a label to let the user know if the delete succeeded. <asp:Label ID="lblResult" runat="server" Width="346px"></asp:Label>
Add the following information to the code behind of your aspx.vb page.
Protected Sub btnDeleteFolder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDeleteFolder.Click
If Not IsNumeric(txtFolderId.Text) Then lblResult.Text = "Invalid Folder ID" Exit Sub End If
Dim folderApi As New Ektron.Cms.API.Folder
Try folderApi.DeleteFolderById(CInt(txtFolderId.Text))
lblResult.Text = "The above folder was deleted from CMS400.NET"
Catch ex As Exception lblResult.Text = "Error deleting folder" End Try End Sub
Copyright (c) 2008. All rights reserved.
|
What do you think about this topic? Send feedback!
|