Work with threads

Create a thread

When creating a thread, you must perform the following:

  1. Get an instance of the Comment Service using the GetCommentsService method part of the SystemManager.
  2. Create an AuthorProxy.
    When creating comments, information is required about the author of the new comment, for example a name, email, and so on. Therefore, there is a  AuthorProxy class which implements the IAuthor interface.
  3. To create a thread, you need to create a ThreadProxy.
    The constructor requires as parameters a title, item type, group key, and an author.
  4. Create the thread using the CreateThread method as part of the comment service.
The following code creates a thread:

Query threads

Use any of the following options to retrieve threads:

  • Get a thread by threadKey:
  • Get all threads by specific criteria.
    You must use the GetThreads method part of the comments service:

Modify threads

You can update existing thread properties using the UpdateThread method. The sample below demonstrates how to change the IsClosed property of the thread:

Delete threads

You can delete a thread using the DeleteThread method:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Work with groups