Relativity Services API (RSAPI) DTOs have been deprecated and are no longer supported. For more information and alternative APIs, see RSAPI deprecation process.


You can use the MonthOfCondition to query date fields. For example, you can query email where the date sent is in a certain month. It is equivalent to adding this search condition in Relativity UI:

When constructing the query condition, specify the field, the condition operator, and the month value.

  • Use the MonthOfConditionEnum.In to specify the operator.
  • Use the kCura.Relativity.Client.Month enumeration to specify the month:
    Member NameValueDescription
    NotSet 0 Not Set
    January 1 January
    February 2 February
    March 3 March
    April 4 April
    May 5 May
    June 6 June
    July 7 July
    August 8 August
    September 9 September
    October 10 October
    November 11 November
    December 12 December

The following code sample illustrates how to query using the MonthOfCondition condition to return all email where the sent date is in May.

public bool Query_MonthOfCondition_In_Document_DateTimeField(Client.SamplesLibrary.Helper.IHelper helper)
    //Get a connection to the API using the API helper classes, available in Event Handlers,
    //Agents, and Custom Pages. They are mocked here for samples purposes
    //NOTE: We are executing under the context of the current user. For more info, see the APIHelper documentation
    using (IRSAPIClient proxy = helper.GetServicesManager().CreateProxy<IRSAPIClient>(ExecutionIdentity.User))
        //Set the ForContext for the method.
        kCura.Relativity.Client.SamplesLibrary.Logging.ISampleLogger logger = _logger.ForContext("MethodName", new StackFrame(0).GetMethod().Name, false);

        //Set the workspace ID
        //NOTE: SampleWorkspace_ID is sample data created for this example
        proxy.APIOptions.WorkspaceID = this.SampleWorkspace_ID;

        //Build the condition
        //The EqualTo keyword will look for exact matches only
        //NOTE: The constructor accepts IDs, Guids, and Field names to identfiy the object
        MonthOfCondition condition = new MonthOfCondition("Date Sent", MonthOfConditionEnum.In, kCura.Relativity.Client.Month.May);

        //Define the Query
        Query<DTOs.Document> query = new Query<Document> {Condition = condition};

        //Create ResultSet for the Query and query for the RDOs in a try/catch
        DTOs.QueryResultSet<DTOs.Document> resultSet = new DTOs.QueryResultSet<DTOs.Document>();
            resultSet = proxy.Repositories.Document.Query(query);
        catch (Exception ex)
            logger.LogError(ex, "Unhandled Exception");
            return false;

        //Check the success
        if (resultSet.Success)
            logger.LogDebug("Number of Documents returned: {TotalCount}", resultSet.TotalCount);
            return true;
            return false;