{"id":4411,"date":"2017-08-21T15:14:08","date_gmt":"2017-08-21T15:14:08","guid":{"rendered":"https:\/\/answers.gurussolutions.com\/answers\/comment-effectuer-une-recherche-darticles-en-stock-a-laide-de-lapi-soap-suitetalk-de-netsuite-en-c\/"},"modified":"2026-07-28T18:26:44","modified_gmt":"2026-07-28T18:26:44","slug":"comment-effectuer-une-recherche-darticles-en-stock-a-laide-de-lapi-soap-suitetalk-de-netsuite-en-c","status":"publish","type":"qa_entry","link":"https:\/\/answers.gurussolutions.com\/fr\/answers\/comment-effectuer-une-recherche-darticles-en-stock-a-laide-de-lapi-soap-suitetalk-de-netsuite-en-c\/","title":{"rendered":"Comment effectuer une recherche d&rsquo;articles en stock \u00e0 l&rsquo;aide de l&rsquo;API SOAP SuiteTalk de NetSuite en C# ?"},"content":{"rendered":"","protected":false},"template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","ga_subtitle":"Apprenez \u00e0 rechercher par programmation des articles en stock par mot-cl\u00e9 et par type \u00e0 l\u2019aide de l\u2019API SOAP SuiteTalk de NetSuite avec C#.","ga_short_answer":"Pour rechercher des articles en stock dans NetSuite \u00e0 l\u2019aide de C# et de l\u2019API SOAP SuiteTalk, instanciez un objet ItemSearch, d\u00e9finissez SearchStringField pour le nom de l\u2019article et SearchEnumMultiSelectField pour le type d\u2019article, puis lancez la recherche via _service.search. Parcourez les r\u00e9sultats pour afficher les d\u00e9tails des articles.","ga_scenario":"Les d\u00e9veloppeurs qui int\u00e8grent des applications externes \u00e0 NetSuite ont souvent besoin de r\u00e9cup\u00e9rer des fiches d\u2019articles de stock sp\u00e9cifiques. Une exigence courante consiste \u00e0 rechercher des articles \u00e0 partir de mots-cl\u00e9s figurant dans leur nom et \u00e0 les filtrer par type d\u2019article, par exemple les articles de stock, afin de garantir une r\u00e9cup\u00e9ration pr\u00e9cise des donn\u00e9es pour les processus m\u00e9tier.","ga_solution":"Les ressources pour d\u00e9veloppeurs NetSuite fournissent des exemples en C# illustrant comment interagir avec l\u2019API SOAP SuiteTalk. Le code C# suivant montre comment effectuer une recherche d\u2019articles en stock par nom et par type, et inclut une m\u00e9thode d\u2019aide permettant d\u2019afficher les champs des articles. Cette approche utilise des objets tels que ItemSearch, SearchStringField, SearchEnumMultiSelectField, ItemSearchBasic et la m\u00e9thode _service.search pour d\u00e9finir les crit\u00e8res de recherche et les appliquer.\n```\nprivate String ITEM_TYPE  \"_inventoryItem\";\n          \/\/\/ <summary> Searches for InventoryItem records based on a\nkeyword entered by\n          \/\/\/ the user.  All inventory items, including parent items,  with the\n          \/\/\/ keyword found in their name field will be returned.\n          \/\/\/ <\/summary>\n\n    public virtual void  searchInventoryItemByName()\n                    {\n    _out.writeLn(\"Enter a keyword of the item name to be searched\");\n     System.String keyWordString  _out.readLn();\n\n                    ItemSearch itemSearch  new ItemSearch();\n\n                    SearchStringField name  new SearchStringField();\n                    name.@operator  SearchStringFieldOperator.contains;\n                    name.operatorSpecified  true;\n                    name.searchValue  keyWordString;\n\n                    SearchEnumMultiSelectField type  new\nSearchEnumMultiSelectField();\n                    String[] inv  new String[1];\n                    inv[0]  ITEM_TYPE;\n                    type.@operator  SearchEnumMultiSelectFieldOperator.anyOf;\n                    type.operatorSpecified  true;\n                    type.searchValue  inv;\n\n                    ItemSearchBasic itemBasic  new ItemSearchBasic();\n                    itemBasic.type  type;\n                    itemBasic.itemId  name;\n\n                    itemSearch.basic  itemBasic;\n\n                    SearchResult res  _service.search(itemSearch);\n                    if (res.status.isSuccess)\n                    {\n                        Record[] recordList;\n                        _out.writeLn(\"\n\nNumber of items found with thenkeyword \" + keyWordString + \": \" + res.totalRecords);\n                        if (res.totalRecords > 0)\n                        {\n                            _out.writeLn(\"\n\nPage size: \" + res.pageSize);\n\n                            for (int i  1; i < res.totalPages; i++)\n                            {\n                                recordList  res.recordList;\n                                _out.writeLn(\"Page \" + res.pageIndex);\n                                _out.writeLn(\"------\");\n\n                                for (int j  0; j < recordList.Length; j++)\n                                {\n                                    if (recordList[j] is InventoryItem)\n                                    {\n                                        InventoryItem item\n(InventoryItem) (recordList[j]);\n                                        displayInventoryItemFields(item);\n                                    }\n                                }\n                                if (res.pageIndex < res.totalPages)\n                                {\n                                    res\n_service.searchMoreWithId(res.searchId, i + 1);\n                                }\n                            }\n                        }\n                    }\n                    else\n                    {\n                        _out.error(getStatusDetails(res.status));\n                    }\n                }\n```\n\n```\n\/\/\/ <summary> A helper method that takes an\nInventoryItem and prints out\n                \/\/\/ its Display Name, Item ID and Cost fields.\n                \/\/\/ <\/summary>\n                private void  displayInventoryItemFields(InventoryItem item)\n                {\n                    if (item ! null)\n                    {\n                        if (item.displayName ! null)\n                        {\n                            _out.writeLn(\"     Display Name:\n     \" + item.displayName);\n                        }\n                        else\n                        {\n                            _out.writeLn(\"     Display Name:\n     none\");\n             \n                        }\n                    }\n                }\n```","ga_source_author":"","ga_source_author_email":"","ga_date_original":"2017-08-21T11:14:08-04:00","ga_date_verified":"2026-07-05","ga_source_subject":".NET code samples (C sharp, c#)","ga_ans_id":"ANS-0752","ga_publish_decision":"publish_with_edits","ga_staleness_risk":"high","ga_review_priority":"verify_soon","ga_tier2_verdict":"partially_outdated","ga_tier2_concerns":"The specific 'ERP sample' and file 'NSClientERP.cs' are not explicitly mentioned in current NetSuite developer resources or documentation, suggesting this particular sample might be outdated or no longer the primary recommended resource.","ga_final_category":"Web Services & Integrations","footnotes":""},"ga_category":[102,28,102],"ga_audience":[56],"ga_difficulty":[92],"class_list":["post-4411","qa_entry","type-qa_entry","status-publish","hentry","ga_category-services-web-et-integrations","ga_category-web-services-integrations","ga_audience-developer-integration-team","ga_difficulty-niveau-intermediaire"],"taxonomy_info":{"ga_category":[{"value":102,"label":"Services Web et int\u00e9grations"},{"value":28,"label":"Web Services & Integrations"},{"value":102,"label":"Services Web et int\u00e9grations"}],"ga_audience":[{"value":56,"label":"Developer\/Integration team"}],"ga_difficulty":[{"value":92,"label":"Niveau interm\u00e9diaire"}]},"featured_image_src_large":[],"author_info":[],"comment_info":"","_links":{"self":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry\/4411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry"}],"about":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/types\/qa_entry"}],"version-history":[{"count":1,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry\/4411\/revisions"}],"predecessor-version":[{"id":6332,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry\/4411\/revisions\/6332"}],"wp:attachment":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/media?parent=4411"}],"wp:term":[{"taxonomy":"ga_category","embeddable":true,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/ga_category?post=4411"},{"taxonomy":"ga_audience","embeddable":true,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/ga_audience?post=4411"},{"taxonomy":"ga_difficulty","embeddable":true,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/ga_difficulty?post=4411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}