I have successfully created discussions and replies using code in my Community site on SP 2013 server. Actually i received XML files containing the Discussions and Replies along with the corresponding metadata (Created Date, Created By, Modification Date,...).

After my code executes, all the discussions and replies are in place. But, the metadata is lost i.e. everywhere it shows my name in Created By and current date-time as last modified.

Actually in my case it should be this way only. Because i haven't written any code for updating metadata.

My question is whether it is possible to update these metadata fields programmatically or not ?

1 Answer 1


Actually, I was able to update the Created, Author, Modified and Editor fields for the Discussions and Replies. It turned out to be pretty straight forward. Below is the code snippet of how I did this.

newSPReply[SPBuiltInFieldId.Created] = replyResultset.GetDateTime(1);

newSPReply["Author"] = getUserIDByLogonName(repliedBy);

newSPReply[SPBuiltInFieldId.Modified] = replyResultset.GetDateTime(2);

newSPReply["Editor"] = getUserIDByLogonName(repliedBy);


Now, I am thinking what made me post this question before even trying the most obvious thing. And, surprisingly nobody even suggested this in last 5 days..... :)

Anyways, thanks to all those who invested time in this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.