London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

EPiServer Community Api Comment Date

Vote:
0

Hello, I'm importing comments from a wordpress blog and everything is working as expected except the comment's `Created` property which seems to get overriden to the current time (in our scheduled job). The following lines create the comment, the `epiComment` object has a `Created` DateTime in 2011 but the `addedComment` is returned with the current time:

```

var epiComment = new Epi.Comment(commentId, parent, authorRef, comment.Content, true,
ancestors, comment.Date, hasChildren, hasChildren);

if(!string.IsNullOrWhiteSpace(comment.AuthorEmail))
{
    var commentEx = new BlogCommentExtension(comment.AuthorEmail);

    var addedComment = _commentService.Add(epiComment, commentEx);
}
else
{
    _commentService.Add(epiComment);
}

```

#227065
Aug 26, 2020 19:30
Vote:
0

Bump.

This seems like a bug, no?

#227170
Aug 28, 2020 16:38
Vote:
0

Looks like a missing feature. If you dig into the code when you fire off the Add method it builds up like this:

public AddRequest Adapt(Comment comment)
{
    return new AddRequest
    {
        Parent = comment.Parent.ToString(),
        Author = (string.IsNullOrWhiteSpace(comment.Author.Id) ? "" : comment.Author.Id),
        IsVisible = comment.IsVisible,
        Body = comment.Body
    };
}

So I would make the guess that "Created" is handled on the api server side. 

#227458
Sep 04, 2020 14:34
Vote:
0

Yea, I figured it was a bug. Thanks for looking into that Spencer.

I may add an imported date to my BlogCommentExtension class to get around this.

#227459
Sep 04, 2020 16:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.