I am working on a Discussion Board list inside SharePoint 2013 on-premise. The Discussion Board list is inside a Team Site collection which have the publishing infrastructure features enabled (both at the site collection and the site level).
We have a couple of old announcements inside our emails and documents which we need to upload inside the Discussion Board list.
so I wrote the following PowerShell script, to add old announcements to the SharePoint Discussion Board list:
$web = Get-SPWeb "http://servername/"
$list = $web.Lists["News & Announcements"]
$newItem = $List.AddItem()
$newItem["Title"] = "Test announcment"
$newItem["Name"] = "Test announcment"
$newItem["Body"] = "test body"
$newItem["Modified"] = "9/3/2015"
$newItem["Created"] = "8/3/2015"
$user = $web.EnsureUser("\staging.user")
$newItem["Editor"] = $user
$newItem["Author"] = $user
$newItem.UpdateOverwriteVersion()
Now this PowerShell script will create a new Discussion item with all the specified data correctly, but when I open the new Discussion item I have noted that the item's Name will have the following format "ITEMID_.000", instead of showing the item's title or name (Test Announcement in my case) as when creating a new Discussion item using the UI. here is the result of running the above PowerShell script:
When I click on the item compliance details for the item , I got this where it clearly state that the name is wrong:
So can anyone advice what is going on? And how I can show the Discussion title instead of "ITEMID_.000"?
Thanks
$list
=$List
, but you shouldn't change the case when trying to refer to the same variable.$web = Get-SPWeb "http://servername/"
$list = $web.Lists["News & Announcements"]
$list.BaseType
BaseTemplate
notBaseType