1

I am trying to add items to a sharepoint 2013 list like this,$new is a collection of items:

foreach ($si in $new) 
        {
            $newItem = $listItems.add() 
            $newitem["Title"] = $si.NewTopics
            $newitem.update() 
        }  

When I run this I am getting an error:

Cannot find an overload for "add" and the argument count: "0".
1

I suggest that you use

$newItem = $list.Items.Add()

#additional tweaks here
#$newItem["SomeField"] = "SomeValue"

$newItem.Update()

This should work, unless there is something wrong with your collection.

$list.Items.Add

OverloadDefinitions
-------------------
Microsoft.SharePoint.SPListItem Add()
Microsoft.SharePoint.SPListItem Add(string folderUrl,
Microsoft.SharePoint.SPFileSystemObjectType underlyingObjectType, string
leafName)
Microsoft.SharePoint.SPListItem Add(string folderUrl,
Microsoft.SharePoint.SPFileSystemObjectType underlyingObjectType)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.