Delete forum posts
To delete a thread, you must perform the following:
- Get an instance of the manager.
Get an instance of the ForumsManager object.
- Get the specified post.
Get an instance of the post. For more information, read For developers: Query forum posts.
- Mark the post for deletion.
To mark the post to be deleted, call the DeletePost method of the manager and pass the post as an argument.
- Save the changes.
To delete the post, save the changes to the manager.
NOTE: To delete multiple posts, query them and execute the code below for each post.
NOTE: If you try to delete a post that has attachments in it, the document items that represent the attachments, won't get deleted. To delete the attachments, you must get them and manually delete them. For more information, see For developers: Get the attachments of forum posts and For developers: Delete documents.
Here is a code example: