Hi,
If a discussion topic gets a best reply then the ID of the best reply is stored in Best Response ID Column. So I am trying the following to get the ONLY Topics of a user which has best Replies, but gives me error.
var url = siteURL + "/_api/web/lists/getbytitle('"+listname+"')/Items?$select=Title,Author/Title,Author/EMail,Author/FirstName,Author/LastName&$expand=Author/Id&$filter=(ContentType eq 'Discussion') and (Author/Id eq 10) and (Best_0x0020_Response_0x0020_Id gt 0)
$.ajax({
url: url,
method: "GET",
async: false,
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
if(data.d.results.length<1){
alert("No items");
history.go(-1);
}
else{
var Title = "";
var BestResponseId = "";
for (var i = 0; i < data.d.results.length; i++) {
Title = Title + data.d.results[i].Best_0x0020_Response_0x0020_Id+ ".\n";
}
alert("Many items\n" + Title );
$.each(data.d.results, function(key, val) {
console.log(val.Best_0x0020_Response_0x0020_Id);
});
}
},
error: function (data) {
alert("error");
}
});
If I write a loop to see all column names of this Discussion list, I could see best Response Id column.