Plumtree EDK (Enterprise Web Development Kit) 5.4.0

IDiscussionManager.QueryDiscussionMessages Method (IProject, IDiscussionMessageFilter)

Returns an array of IDiscussionMessage containing zero or more discussion messages in a given project, satisfying the discussion message filter criteria.

IDiscussionMessage[] QueryDiscussionMessages(
   IProject project,
   IDiscussionMessageFilter filter
);

Parameters

project
Project to query discussion messages; cannot be null.
filter
The discussion message query filter; cannot be null.

Return Value

an array of IDiscussionMessage containing zero or more discussion messages in a given discussion, satisfying the discussion message filter criteria.

Remarks

The following sample code shows how to query for discussion messagess in a project.

IDiscussionMessageFilter messageFilter = discussionManager.CreateDiscussionMessageFilter();

//search for ALL messages; other options include searching for APPROVED, or UNAPPROVED messages
messageFilter.MessageStatusType = DiscussionMessageStatusFilterTypes.All;

//limit the return results to be 10; setting this to 0 will return all results
messageFilter.MaximumResults = 10;

//disable security checking on the returned objects against the user who performs this query,
//so that all objects will be returned
messageFilter.RestoreSecurity = false;

//user DiscussionMessageQueryOrder to sort the query result; below DiscussionMessageQueryOrder
//shows sorting the returned messages by CREATED date in descending order
DiscussionMessageQueryOrder messageQueryOrder = new DiscussionMessageQueryOrder(DiscussionMessageAttributes.Created, false);
messageFilter.setQueryOrders(new DiscussionMessageQueryOrder[] { messageQueryOrder });

//an array of IDiscussionMessage objects are returned from queryDiscussionMessages(); if no result is retrieved, a zero-length array will be returned
IDiscussionMessage[] retrievedMessages = discussionManager.QueryDiscussionMessages(project, messageFilter);

Exceptions

Exception Type Condition
InvalidOperationException The project has not yet been stored or has already been removed.
CollaborationException The method call resulted in an error.
SoapException There is a communication problem during the execution of the remote method call.

See Also

IDiscussionManager Interface | Plumtree.Remote.PRC.Collaboration.Discussion Namespace | IDiscussionManager.QueryDiscussionMessages Overload List