Hi, try this:
var application = new Application();
var document = application.Documents.Open(FileName: @"C:\Sample In.docx");
var tocRange = document.Range(0, 0);
var toc = document.TablesOfContents.Add(
Range: tocRange,
UseHeadingStyles: true);
toc.Update();
var tocTitleRange = document.Range(0, 0);
tocTitleRange.Text = "List of Images";
tocTitleRange.InsertParagraphAfter();
tocTitleRange.set_Style("Title");
document.SaveAs2(@"C:\Sample Out.docx");
document.Close();
application.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(application);