{"id":29293,"date":"2021-01-29T18:36:52","date_gmt":"2021-01-29T18:36:52","guid":{"rendered":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/?p=29293"},"modified":"2024-05-08T05:05:54","modified_gmt":"2024-05-08T05:05:54","slug":"how-to-get-user-details-using-comapi-in-c","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/","title":{"rendered":"How to get User Details using COMAPI in C#"},"content":{"rendered":"\n<p>We are aware that in Sage 300 database there are no such tables provided to get to know the details of the Users created in the Sage 300 ERP and also in all other sage 300 tables we only have user id information saved about the user. But many of the customers who need the export reports of transactions expect the user name in the report rather than the user id and may also need some other details about the user such as role,phone,email,etc. During development of such export utility programmer may come across situation where they cant find the table to get the user details in sage 300 database.<\/p>\n\n\n\n<p>So, in this blog, we will discuss about how to get the user details such as username,role, phone,email using the COMAPI through the accpaview.<br><br><strong>New Stuff: <\/strong>\u2013<a href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/e-invoicing-in-sage-300-erp\/\">E-Invoicing in Sage 300 ERP<\/a><br><br><strong>Step 1:<\/strong><\/p>\n\n\n\n<p>Include the Sage 300 COMAPI in the project.<\/p>\n\n\n\n<p><strong>Step 2:<\/strong><\/p>\n\n\n\n<p>Once the COMAPI DLL is included, create the object of the DBLink and open the DBLink object using the session object .<\/p>\n\n\n\n<p>AccpacCOMAPI.AccpacDBLink DBLinkCmpRE=<br>mSession.OpenDBLink( AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY,<br>AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);<\/p>\n\n\n\n<p><strong>Step 3:<\/strong><\/p>\n\n\n\n<p>Open the accpacview &#8216;AS0003&#8217; using the DBLink and assign the USERID(e.g. &#8211; ADMIN) to the accpacview of which we need to fetch details.<\/p>\n\n\n\n<p>AccpacCOMAPI.AccpacView ASUSER1;<br>AccpacCOMAPI.AccpacViewFields ASUSER1Fields;<\/p>\n\n\n\n<p>DBLinkCmpRE.OpenView(&#8220;AS0003&#8221;, out ASUSER1);<br>ASUSER1Fields = ASUSER1.Fields;<br>ASUSER1Fields.Item(&#8220;USERID&#8221;).PutWithoutVerification(&#8220;ADMIN&#8221;);<\/p>\n\n\n\n<p><strong>Step 4:<\/strong><\/p>\n\n\n\n<p>Now we call the browse and Fetch method to return the records of the respective userid.<\/p>\n\n\n\n<p>string res = &#8220;&#8221;;<br>ASUSER1.Browse(&#8220;&#8221;, true);<br>ASUSER1.Fetch();<br>res = ASUSER1.Fields.Item(&#8220;USERNAME&#8221;).get_Value();<\/p>\n\n\n\n<p>Using the above script we can also get other user details such as role,phone,email,etc based on the fields in the &#8216;AS0003&#8217; accpacview.<br><br><\/p>\n\n\n\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><\/p>\n\n\n\n<p><a href=\"https:\/\/www.greytrix.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Greytrix<\/a>&nbsp;&#8211; a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0offers unique <a href=\"https:\/\/www.greytrix.com\/gumu\/connectors\/\">GUMU&#x2122;<\/a> integrated solutions of\u00a0\u00a0<a href=\"https:\/\/www.greytrix.com\/salesforce-cloud-services\/sage-300-integration\/\">Sage 300 <\/a>with Sage CRM,\u00a0Salesforce(listed on Salesforce Appexchange), Dynamics 365 CRM, and\u00a0Magento eCommerce,\u00a0along with Sage 300 Migration from\u00a0<a href=\"https:\/\/www.greytrix.com\/sage-300-erp\/\">Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business <\/a><a href=\"https:\/\/www.greytrix.com\/resources\/sage-erp-crm-migration.pdf\">Works<\/a>. We also offer best-in-class\u00a0Sage 300 customization and development services\u00a0and integration services for applications such as\u00a0<a href=\"https:\/\/www.greytrix.com\/sage-300-erp\/\">POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP<\/a>\u00a0and for Sage 300c development services we offer, upgrades of older codes and screens to new web screens, latest integrations using Data and web services to Sage business partners, end users and Sage PSG worldwide. <\/p>\n\n\n\n<p>Greytrix offers 20+ add-ons for Sage 300 to enhance productivity such as\u00a0GreyMatrix,\u00a0Document Attachment,\u00a0Document Numbering,\u00a0Auto-Bank Reconciliation,\u00a0Purchase Approval System,\u00a0Three-way PO matching,\u00a0Bill of Lading,\u00a0and\u00a0VAT for the Middle East. The GUMU&#x2122; integration for Dynamics 365 CRM \u2013 Sage ERP is listed on Microsoft Appsource with an easy implementation package. <\/p>\n\n\n\n<p>The GUMU&#x2122; Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button. <\/p><p>For more details on Sage 300 and Sage 300c Services, please contact us at&nbsp;<a href=\"mailto:accpac@greytrix.com\">accpac@greytrix.com<\/a>, We will like to hear from you.<\/p>\n\n\n\n<p>Related Posts:-<br>1.<a href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2020\/12\/21\/how-to-use-blkput-to-save-data-into-sage-300-using-comapi-in-c\/\">How to use BlkPut to save data into Sage 300 using COMAPI in C#<\/a><br>2.<a href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2020\/11\/30\/how-to-use-blkget-to-fetch-data-from-sage-300-using-comapi-in-vb6-0\/\">How to use BlkGet to fetch data from Sage 300 using COMAPI in VB6.0<\/a><br>3.<a href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2020\/11\/30\/how-to-use-blkget-to-fetch-data-from-sage-300-using-comapi-in-c\/\">How to use BlkGet to fetch data from Sage 300 using COMAPI in C#<\/a><br>4.<a href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2020\/08\/31\/sage-300-view-to-read-data-using-comapi-in-vb6-0\/\">Sage 300 view to read data using COMAPI in VB6.0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are aware that in Sage 300 database there are no such tables provided to get to know the details of the Users created in the Sage 300 ERP and also in all other sage 300 tables we only have user id information saved about the user. But many of the customers who need the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3475,2357],"class_list":["post-29293","post","type-post","status-publish","format-standard","hentry","category-sage-accpac","tag-comapi","tag-sage-300-erp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Use COMAPI in C# to Retrieve User Details<\/title>\n<meta name=\"description\" content=\"Discuss how to leverage the COMAPI through the account to retrieve user information such as username, role, phone number, and email.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use COMAPI in C# to Retrieve User Details\" \/>\n<meta property=\"og:description\" content=\"Discuss how to leverage the COMAPI through the account to retrieve user information such as username, role, phone number, and email.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Sage 300 ERP \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-29T18:36:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-08T05:05:54+00:00\" \/>\n<meta name=\"author\" content=\"Greytrix\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Greytrix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/\",\"name\":\"How to Use COMAPI in C# to Retrieve User Details\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#website\"},\"datePublished\":\"2021-01-29T18:36:52+00:00\",\"dateModified\":\"2024-05-08T05:05:54+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#\/schema\/person\/93977cd8aa8fbd1f151d3f664e29c9f2\"},\"description\":\"Discuss how to leverage the COMAPI through the account to retrieve user information such as username, role, phone number, and email.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to get User Details using COMAPI in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/\",\"name\":\"Sage 300 ERP \u2013 Tips, Tricks and Components\",\"description\":\"Explore the world of Sage 300 with our insightful blogs, expert tips, and the latest updates. We\u2019ll empower you to leverage Sage 300 to its fullest potential. As your one-stop partner, Greytrix delivers exceptional solutions and integrations for Sage 300. Our blogs extend our support to businesses, covering the latest insights and trends. Dive in and transform your Sage 300 experience with us! \",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#\/schema\/person\/93977cd8aa8fbd1f151d3f664e29c9f2\",\"name\":\"Greytrix\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3cdb553d6ca07df0e407d5e092f2410d163e0fd40b27734b345b04c8f0786969?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3cdb553d6ca07df0e407d5e092f2410d163e0fd40b27734b345b04c8f0786969?s=96&d=mm&r=g\",\"caption\":\"Greytrix\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/author\/greytrix\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use COMAPI in C# to Retrieve User Details","description":"Discuss how to leverage the COMAPI through the account to retrieve user information such as username, role, phone number, and email.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/","og_locale":"en_US","og_type":"article","og_title":"How to Use COMAPI in C# to Retrieve User Details","og_description":"Discuss how to leverage the COMAPI through the account to retrieve user information such as username, role, phone number, and email.","og_url":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/","og_site_name":"Sage 300 ERP \u2013 Tips, Tricks and Components","article_published_time":"2021-01-29T18:36:52+00:00","article_modified_time":"2024-05-08T05:05:54+00:00","author":"Greytrix","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Greytrix","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/","url":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/","name":"How to Use COMAPI in C# to Retrieve User Details","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#website"},"datePublished":"2021-01-29T18:36:52+00:00","dateModified":"2024-05-08T05:05:54+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#\/schema\/person\/93977cd8aa8fbd1f151d3f664e29c9f2"},"description":"Discuss how to leverage the COMAPI through the account to retrieve user information such as username, role, phone number, and email.","breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/2021\/01\/29\/how-to-get-user-details-using-comapi-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/"},{"@type":"ListItem","position":2,"name":"How to get User Details using COMAPI in C#"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#website","url":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/","name":"Sage 300 ERP \u2013 Tips, Tricks and Components","description":"Explore the world of Sage 300 with our insightful blogs, expert tips, and the latest updates. We\u2019ll empower you to leverage Sage 300 to its fullest potential. As your one-stop partner, Greytrix delivers exceptional solutions and integrations for Sage 300. Our blogs extend our support to businesses, covering the latest insights and trends. Dive in and transform your Sage 300 experience with us! ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#\/schema\/person\/93977cd8aa8fbd1f151d3f664e29c9f2","name":"Greytrix","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3cdb553d6ca07df0e407d5e092f2410d163e0fd40b27734b345b04c8f0786969?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3cdb553d6ca07df0e407d5e092f2410d163e0fd40b27734b345b04c8f0786969?s=96&d=mm&r=g","caption":"Greytrix"},"url":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/author\/greytrix\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/posts\/29293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/comments?post=29293"}],"version-history":[{"count":2,"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/posts\/29293\/revisions"}],"predecessor-version":[{"id":29295,"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/posts\/29293\/revisions\/29295"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/media?parent=29293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/categories?post=29293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sageaccpacerp\/wp-json\/wp\/v2\/tags?post=29293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}