Adding SPComments in code


Badge +3

I have a custom ASPX page to handle opening a worklistitem and executing the action.  It is an approval workflow for SharePoint listitems being added/updated.


I want to also add the ability for the user to be able to add a comment when submitting their action.  I know there is the SPComments, but it looks like I will need to read them into an XmlDocument and add a new nodelist for each new comment, then save it back?


I'm surprised this is so complicated.  Anyone have an example or suggestion?


The part I'm especially unsure of is the attribute "EventName" for the Comments element.  Do I need to first check if the current EventName exists - then add a new Comment nodeList to that? If not, then create a new Comments nodelist?


Will the comments added here show up in the Workflow history list?


The following is the Xml schema:


<?xml version="1.0" encoding="utf-8" ?>
<FormComments>
  <Comments EventName="">
    <Comment>
      <UserName />
      <DisplayName />
      <DateTime />
      <Body />
      <Action />
    </Comment>
  </Comments>
</FormComments>


0 replies

Be the first to reply!

Reply