Wednesday, August 15, 2012

SharePoint Search problem after migration

After migrating from WSS 3.0 to Foundation 2010 cannot search inside a document.
Basically it shows in the document property "Pending", so the document waiting for approval.
Created a small PowerShell script to approve all documents on a site:
________________________________________________________________________

$mySite=Get-SPSite "http://yoursite"
$myWebSub=$mySite.AllWebs
foreach ($myWeb in $myWebSub)
{
    $myWeb=Get-SPWeb $myWeb.url
    $myWeb.url
    $myLIb=$myWeb.lists|where {($_.BaseTemplate -eq "DocumentLibrary")}
    foreach ($lib in $myLib)
    {
        $lib.Title
        $myDocs=$lib.Items
        foreach ($doc in $MyDocs)
        {
            $doc.name                             # only for information
            $doc.file.level                       # only for information
            if (($doc.file.level -eq "Draft") -or ($doc.file.level -eq "Pending")){$doc.file.Approve("script")}
            $doc.file.level                        # only for information
           
        }
    }
}

No comments:

Post a Comment