Work with threads
Create a thread
When creating a thread, you must perform the following:
The following code creates a thread:
- Get an instance of the Comment Service using the GetCommentsService method part of the SystemManager.
- 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.
- To create a thread, you need to create a ThreadProxy.
The constructor requires as parameters a title, item type, group key, and an author.
- Create the thread using the CreateThread method as part of the comment service.
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:
You can update existing thread properties using the UpdateThread method. The sample below demonstrates how to change the IsClosed property of the thread:
You can delete a thread using the DeleteThread method: