1

I have a huge library and its documents don't have any metadata. They have only the name (FileLeafRef) filled (and FileRef -> file's path automatically filled).

I'm trying to update their metadata (columns) using webservices. To do that, I enter the FileRef to get the ID of the file, and then execute the webservice to update using the returned ID. But this is taking to long, due the big number of documents.

Then, I will create a new index based on the column FileRef, so it'll be faster.

Does anyone know how to create a new index based on an internal field (using powershell)?

Thanks,

Douglas

1

I use the following function to add an index

Function AddIndex ()
    {
    Param ($list,$InternalFldName)

        try
            {
             Write-Host "Updating index for list: $list";

            $fldToIndex =$list.Fields.GetFieldByInternalName($InternalFldName);                                                 
            try
              {
                 $index= $list.FieldIndexes.Item($fldToIndex.Id)
                 Write-Host  "Field $fldToIndex is indexed." -ForegroundColor Yellow
              }
              catch
              {
                 $fldToIndex.Indexed = $true;    
                 $list.FieldIndexes.Add($fldToIndex);
                Write-Host "Field $fldToIndex is added to indexed columns."  -ForegroundColor Green 
               }
            }
        catch
            {
             $error[0]
            }
            Write-Host 
    }

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.