I reflect the "_layouts/15/EditIndex.aspx" to see how we can delete the SharePoint List indexes, and I found the following:
protected void DeleteIndex()
{
if (this.m_indexId != Guid.Empty)
{
if (this.m_secondaryField != Guid.Empty)
{
this.m_list.FieldIndexes.Delete(this.m_indexId);
}
else
{
SPField field = this.m_list.Fields[this.m_primaryField];
field.Indexed = false;
field.Update();
}
}
}
I'm wondering why they check if there is secondary field and if not they delete the index from the filed. thy can delete the index directly (FieldIndexes.Delete(this.m_indexId);), and no need to if statement.
protected void DeleteIndex()
{
if (this.m_indexId != Guid.Empty)
{
this.m_list.FieldIndexes.Delete(this.m_indexId);
}
}
0 commentaires:
Enregistrer un commentaire