How to create topic for discussion board in sharepoint using powershell

Advertisement
In this article we can able to see how we can create a new topic for a discussion board list using PowerShell.


#get the site URL
$web=Get-SPweb http://dotnetsharepoint.com/sites/SharePoint/SharePoint2013
#get the List name
$list=$web.Lists["ListName"]
#Check weather the list is availbale or not
if($list -ne $null)
{
#Creating a new discussion
$newTopic = [Microsoft.SharePoint.Utilities.SPUtility]::CreateNewDiscussion($list, "Welcome to DotnetSharePoint");
$newTopic["Body"] = "We hope our site is very usefull to learn new things!";
$newTopic.Update();
Write-Host $newTopic.Title " discussion board topic is created successfully"
}
else
{
Write-Host "List does not exists!"
}


Output:

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

Lakshmi Tulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a comment