I have an announcement list, where i need to populate it with some old data we have on emails, documents, etc. so i did the following:-
1.inside our Team site i added a new "Announcement list" . 2.then i wrote the following power-shell, to be able to add announcement items using our data, as follow:-
PS C:\Windows\system32> $web = get-spweb "http://servername/"
PS C:\Windows\system32> $list = $web.lists["News & Announcements"]
PS C:\Windows\system32> $newItem = $list.items.Add();
PS C:\Windows\system32> $newItem["Title"] = "123";
PS C:\Windows\system32> $newItem["Modified"] = "8/30/2015";
PS C:\Windows\system32> $newItem["Created"] = "6/30/2015";
PS C:\Windows\system32> $newItem["Body"] = "123456789 123456789";
PS C:\Windows\system32> $newItem["Editor"] = "test.user";
PS C:\Windows\system32> $newItem["Author"] = "test.user";
PS C:\Windows\system32> $newItem.Update();
but i got this error :-
Exception calling "Update" with "0" argument(s): "Invalid data has been used to update the list item. The field you are trying to update may be read only." At line:1 char:1 + $newItem.Update(); + ~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SPException
so can anyone advice on this please?