Вопрос

I'm wondering if it's possible to add an Index to a column in every Item of a specific Content Type.

I'm still having issues with the List View Threshold in an Intranet Site Collection so that CQWP's are failing to return items for users.

I thought I might be able to apply the indexing once rather than for every List that uses the Content Type in question Event

Thoughts?

Это было полезно?

Решение

Indexes are associated with List. So you need to modify the list and add index.

You can automate this using PowerShell.

$site = Get-SPsite http://siteurl 

foreach ($web in $site.AllWebs)  
{ 
    #foreach ($list in $web.Lists) 
    for ($i = 0; $i -lt $web.Lists.Count; $i++)
    {
        $list = $web.Lists[$i]
        foreach ($ct in $list.ContentTypes)  
        {  
            if ($ct.Name -eq "Your Content Type Name")  
            {  
                #Logic to create index 
                $field = $list.Fields["Field Name To Index"]
                $field.Indexed = $true
                $field.Update()
            } 
        } 
    }  
    $web.Dispose()  
} 
Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top