I have an issue where using the "Find an item" search function doesn't return all items in my SharePoint Online list.
I have tried all the troubleshooting steps that I can online to no avail such as indexing the columns, ensuring that the items are published and checked in and that content approval is not required on the items.
The list contains around 2500 items, around 2000 of these were migrated from an old SharePoint on premise solution.
The list contains a workflow which runs against each new item in the list which simply updates the reference number of the item. The workflow is only run on new items, as the items migrated already had reference numbers associated with them.
Oddly, I have noticed that the items that were appearing in the search results were only those that had the workflow completed against them.
For example, if you were to search for Copper only 3 results would be returned when I was expecting over 20:
When I located an item that hadn't had the workflow ran against it that began with "Copper" (Copper Sulphate), I re-ran the workflow, and sure enough, after re-indexing the list and waiting a few minutes, it appeared in the search results:
If anyone is able to help me with this it would be greatly appreciated, I know I could run a a Powershell script against the list to run the workflow against each item, but I'd rather understand whats causing this issue first.
Let me know if you need any more info, thanks in advance.
SOLVED
Thanks to @Hellofiona_MSFT who replied in the comments who suggested I simply edit and save items in the list as migrated items wont be being picked up in the search. To do this for the few thousand items in the list I wrote a (crude) Powershell script that creates a column in the list called "Modify". The script then iterates through each item in the list and sets the column modify to "YES" so simulate me editing the items and saving them. I then deleted the column, all of the results now appear in the search. You can see the Powershell below. I'd love a better understanding of why this happens, but I am happy with the fix for now. Hope this helps someone else!
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Variables for Processing
$SiteURL="Sharepoint URL"
$ListName= "List name"
Try {
#Get Credentials to connect
$credential = Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credential.UserName, $credential.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
#Get the List
$List = $Ctx.Web.Lists.GetByTitle($ListName)
$ShemaXml = "<Field DisplayName='Modify' Type='Text' />";
$List.Fields.AddFieldAsXml($ShemaXml,$true,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
$qry = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()
$items = $list.GetItems($qry)
$Ctx.load($items)
$Ctx.ExecuteQuery()
foreach ($item in $items)
{
$editor = $item["Editor"];
$modified = $item["Modified"]
#Update Modify Column to Yes and keep the modified by and date the same
$item["Modify"] = "YES";
$item["Editor"]= $editor;
$item["Modified"] = $modified;
$item.Update()
$ctx.ExecuteQuery()
write-host $item.Id $item.FieldValues.Title -ForegroundColor Green
}
}
Catch {
write-host -f Red "Error" $_.Exception.Message
}