1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Error searching for comments in a custom module

Error searching for comments in a custom module

3 posts, 1 answered
  1. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    09 Jun 2010
    Link to this post

    I am trying to find comments in a custom module using the following code.

    string filter = "ParentID:c1c571b0-92e4-4b78-9f9b-9be4e4356376;DateCreated:06-23-2010 0:00:00;"
    IList listOfComments = manager.GetComments("DateCreated DESC", filter);

    The problem is that i get an "System.FormatException: A string to be converted to a DateTime is not recognized as a valid datetime value." error on the GetComments call. Is the format in the DateCreated property really incorrect? Or is something else wrong. For example, can I specify more than filter?

    Any information would be appreciated.

    Regards,


    David
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    09 Jun 2010
    Link to this post
    Hello David van Geel,

    Thank you for using our services.

    This method uses either short date or long date strings for filtering comments. Bellow is a sample how you can use it:
    ContentManager contentManager = new ContentManager("Blogs");
    string filter = string.Format("ParentID:9fd479f4-0496-4e71-84de-47bb329bac76;DateCreated:{0};", (new DateTime(2010, 5, 5)).ToShortDateString());
    IList comments = contentManager.GetComments("DateCreated ASC", filter);


    Greetings,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  3. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    09 Jun 2010
    Link to this post
    Thanks Radoslav,

    That's what I needed to know!

    Regards,


    David
Register for webinar
3 posts, 1 answered