I am working on a Discussion board list inside SharePoint 2013 and inside its default view, it will always show the discussion which got the latest reply on top (regardless when the discussion was created). now in our case we already have some discussions and replies inside our emails and we want to populate them inside the Discussion board list using power-shell..

so now i already have a discussion created on 6 December 2016. and using power-shell i want to add a reply as follow:-

$web = Get-SPWeb "http://servername/" 
$list=$web.Lists.TryGetList("News & Announcements")
if($list -ne $null)
$sourceItem = $list.GetItemById(35)
$newTopic = [Microsoft.SharePoint.Utilities.SPUtility]::CreateNewDiscussionReply($sourceItem);
$newTopic["Body"] = "Dear All,<br/>


$newTopic["Modified"] = "1/3/2017 16:35"
$newTopic["Created"] = "1/3/2017 16:35"  
$user = $web.EnsureUser("\userA")  
$newTopic["Editor"] = $user  
$newTopic["Author"] = $user  

Write-Host $newTopic.Title " discussion topic is created successfully"
Write-Host "List does not exists." 

now the reply was added successful inside the parent discussion (id = 35),, but the problem is that the parent discussion with id = 35 will be placed at the bottom of the view rather than being shown on top ? so can anyone advice on this please? why adding a reply using power-shell script will not place the discussion on the top as in the case when i manually reply to a discussion using the UI ??


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.