This project has moved. For the latest updates, please go here.

AddDiscussionBoardItem but it is not working for me.

May 30, 2013 at 5:14 PM
I am trying to use AddDiscussionBoardItem but it is not working for me. I could use an example. Here is one of the ways I have tried:
listName: "myListName",
operation: "AddDiscussionBoardItem",
async: false,
message: "New",
completefunc: function (xData, Status) {}
May 30, 2013 at 5:32 PM
If you look at the docs for that operation, you'll see:

The base64Binary content of the item to add.

You're passing in a text value, so that's probably the problem. If you look at the XML which is returned, you should get verification on this.

Jun 20, 2013 at 9:27 PM
Alright. Instead of dealing with base64Binary I used this:
listName: app.listName, operation: "UpdateListItems", async: false,
batchCmd: "New",
valuepairs: [ ["ContentType", "Discussion"],["Title", "discussion" + Number( new Date() )],["Body", "Discussion body..."] ],
completefunc: function (xData, Status) {}

Which works great.
But now I am trying to add an attachment to a Discussion Board.

operation: "AddAttachment", listName: "MyDiscussion",
listItemID: current_row_id, //some ID in the list
fileName:, //png.png
attachment: app.attachment.string, //base64
async: false,
completefunc: function(xData, Status) {}

It works on normal lists but a Discussion Board uses the DISCUSSION and MESSAGE content type. I am able to add attachments in the default SP pages (NewForm.aspx) so I am thinking it is possible.