OfficeDev / office-js-docs

[ARCHIVED] Microsoft Office Add-ins API Reference Documentation
https://docs.microsoft.com/javascript/api/overview/office
398 stars 247 forks source link

getItem(index) information incomplete / misleading #1499

Closed cindymeister closed 5 years ago

cindymeister commented 6 years ago

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.

lindalu-MSFT commented 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!

Rick-Kirkham commented 5 years ago

@cindymeister I'm working on getting this fixed. You don't need to open a new issue.

cindymeister commented 5 years ago

@Rick-Kirkham Thanks :-)

Rick-Kirkham commented 5 years ago

@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!