Closed cindymeister closed 5 years ago
Hi @cindymeister All the content in this repository has been migrated to a new repo (https://github.com/OfficeDev/office-js-docs-reference.) Please verify the issue exists in the new repository, and if so, please open a new issue there. This issue is being closed. Thanks for your contribution!
@cindymeister I'm working on getting this fixed. You don't need to open a new issue.
@Rick-Kirkham Thanks :-)
@cindymeister This turned out to be quite an investigation. We couldn't find where this method description originated in our source files! But we figured it out. The misdescription is a side effect of the sometimes arcane way that our reference content is generated. An internal but has been logged to get this fixed. Thanks again for finding this and thanks for all your help on Stack Overflow!
Article URL
https://docs.microsoft.com/en-us/javascript/api/word/word.contentcontrolcollection?view=office-js#getitem-index-
Issue
The explanation for getItem(index) is: "Gets a content control by its index in the collection." And the expected data type is "number". This implies the method returns the content control at the given position in the document (first, second, etc.) Using the method in this manner returns the error "ItemNotFound: We couldn’t find the item you requested. Check the OfficeExtension.Error.debugInfo for more information."
On Stack Overflow Juan B. Labra states: "getItem() works with IDs".
The ID value of a content control is of type String (in the COM APIs) and it's also not an "index" value. I lost a lot of time trying to get this to work. Plesae update the documentation.