Public Preview: Exchange Online RBAC management in Microsoft Graph using Unified RBAC Schema

Public Preview: Exchange Online RBAC management in Microsoft Graph using Unified RBAC Schema

This article is contributed. See the original author and article here.

Today, we’re excited to announce the public preview of Exchange Online Role Based Access Control (RBAC) management in Microsoft Graph. The preview is designed for admins who want a consistent management interface, and for developers who want to programmatically control RBAC.


The public preview supports create, read, update, and delete APIs in Microsoft Graph which conform to a Microsoft-wide RBAC schema. Exchange Online RBAC role assignments, role definitions, and management scopes are supported through this new API.


With this preview, Exchange Online joins other RBAC systems in the Microsoft Graph Beta API, namely, Cloud PC, Intune, and Azure AD directory roles and entitlement management.


How Unified RBAC for Exchange Online works


Admins assigned the appropriate RBAC role in Exchange Online can access Unified RBAC using the Microsoft Graph beta endpoint or by using Microsoft Graph PowerShell. RBAC data remains stored in Exchange Online and can be configured using Exchange Online PowerShell.


In addition to Exchange RBAC permissions, you will also need one of these permissions:



  • RoleManagement.Read.All

  • RoleManagement.ReadWrite.All

  • RoleManagement.Read.Exchange

  • RoleManagement.ReadWrite.Exchange


Actions and entities supported in this preview:



























































 


Entity



 


Endpoint



Allowed API Actions



Read



Create



Update



Delete



Roles



graph.microsoft.com /beta/roleManagement/exchange/roleDefinitions





X



X





Assignments



graph.microsoft.com /beta/roleManagement/exchange/roleAssignments











Scopes



graph.microsoft.com /beta/roleManagement/exchange/customAppScopes











Role Groups



Not supported



X



X



X



X



Transitive Role Assignment



Not supported



X



X



X



X



Reading the list of role assignments assigned with a management scope:


UnifRBAC01.jpg


Reading the list of Management Scopes:


UnifRBAC02.jpg


List roles using Microsoft Graph PowerShell:


UnifRBAC03.jpg


Try the Public Preview Today


Unified RBAC is available to all tenants today as a part of the public preview. See Use the Microsoft Graph SDKs with the beta API and roleManagement resource type for more information.


We’d love your feedback on the preview. You can leave a comment here or share it with us at exourbacpreview@microsoft.com.


FAQs


Does this API support app-only access?
Not yet. This will be added to the preview later.


Exchange Online Team

You can now save and edit your survey responses

You can now save and edit your survey responses

This article is contributed. See the original author and article here.

People sometimes wish to review and change their form or quiz responses after submission, even days later. We’re happy to share that you can now review and edit responses when needed.


 



  • First, save your response


To save your response, ensure that the form creator has selected “Allow respondents to save their responses” option in the Forms settings.


 


Forms setting - save responseForms setting – save response


Once the setting is enabled, and you submit a form, you will have the option to save your response from the thank you page.


 


“Save my response” in Thank you page


The response will be saved in “Filled forms” in Microsoft Forms.


 


Filled formsFilled forms



  • If enabled, you can then edit your response


 The form’s creator must select “Allow respondents to edit their responses” in the form’s setting.


 


Forms setting - edit responseForms setting – edit response


If enabled, you will have the option to “Save my response to edit” on the thank you page.


 


“Save my response to edit” in Thank you page


As long as the form is open, you have the flexibility to revisit the form at any time to edit your answers. However, edits cannot be made once a form has been closed or deleted.


 


Edit responseEdit response


FAQ


 


Where is the data saved?


As with all forms, the response data will be stored in the form creator’s repository only. Respondents can only view their own and cannot make any changes unless the form creator allows them to edit their response. If the form or the response is removed, the respondent will no longer have access to the response.


 


What’s the limitation of the feature?


Updating a response do not trigger a Power Automate flow. This capability will be enabled soon.


 


We hope you find these new features helpful! We will continue working on enabling more options with Microsoft Forms. Let us know if you have questions or if there’s anything else we can help you with!

Logic Apps Aviators Newsletter – July 2023

Logic Apps Aviators Newsletter – July 2023

This article is contributed. See the original author and article here.

In this issue:






Aviators-Logo@0.75x.png


 


Ace Aviator of the Month


 


July’s Ace Aviator: Anitha Eswaran


AnitaEswaranHeadshot.jfif


 


What is your role and title? What are your responsibilities associated with your position?


I am a Senior Digital Architect with Sonata Software Europe Limited. I am responsible for delivering the right integration technologies to the customers. I interact with my team members to share the latest updates on various integrations and brainstorm the best fit for the client requirement. My manager provides me additional support in exploring new concepts and encourages us to do POCs with latest updates and share the knowledge to the wider forum.


 


Can you provide some insights into your day-to-day activities and what a typical day in your role looks like?


I plan my day beforehand, but it takes a different direction as it progresses.  This is what my role demands. I am involved in multiple assignments and learn everyday with various challenges. More complex it is, the more growth is my thought, and this keeps me motivated throughout the day. I also offer guidance to other teams, and I get excited when the discussion or the task is for Logic Apps integration.


 


What motivates and inspires you to be an active member of the Aviators/Microsoft community?


My spouse, Santosh Ramamurthy, always motivates me in upgrading my skills. He supported my learning path and noticed my passion, he advised me to write blogs, sharing techniques via forums.


I started my career in 2006 and have been travelling with Microsoft Technologies for close to 17 years. With the limited resources those days, we had challenges in getting proper guidance. We referred to books and often learnt from our mistakes. I thought our future generation should have a strong foundation on technologies which they can pass on. So, I started writing blogs, attending forums, giving sessions which will motivate the people who are new to the technology or planning to switch the domain. Resources are abundant nowadays. How to use and where to apply is our skill. Logic Apps Aviators is a community which binds the people at all levels – be it beginner, intermediate or expert.


 


Looking back, what advice do you wish you would have been told earlier on that you would give to individuals looking to become involved in STEM/technology?


As I said earlier, resources are abundant. Learn to use, apply, make mistakes, correct them, and keep moving. Gone are the days where a high-speed PC or a classroom is needed to start your learning path. Most of the technologies are giving free trial and lab environments to encourage the individuals and give an attempt on the new skill. It is only the interest and the passion which keeps their learning spirit on.


 


What has helped you grow professionally?


Passion for learning new skills, handling complexities are my best teachers.  Expand the network and time management is an important skill as we have numerous distractions around us. Tiny drops make a mighty ocean – so learning something new every day (be it simple concept or complex) and we are sure to trace the growth in the learning graph.


 


Imagine you had a magic wand that could create a feature in Logic Apps. What would this feature be and why?


Logic apps can create wonders in integration when some of the minor features can be incorporated to make them more friendly to the beginners.


For instance, when suggesting recurring API integration with D365FO via logic apps, there comes a question of creating a zipped package file. As most connectors are missing this action and even though azure functions / ADF / third-party tool comes to rescue, integration becomes simpler if available readymade.  


Also, a feature to track the state of the previous run – this is needed for integrations to safeguard the data overlap and thus to cancel the run automatically if the previous execution is still in progress.  




News from our product group:


 









































alexzuniga_3-1688394734758.png

 



.NET Framework Custom Code for Azure Logic Apps 


We are excited to announce the public preview release for .NET Framework Custom Code. Read this article to learn more about what’s new. 


alexzuniga_0-1688399428484.png

 



Cargolux Optimizes Workflow and Improves Customer Service with Microsoft Azure


Read about how Cargolux leveraged Azure’s capabilities to streamline their operations, improve efficiency, and deliver a better experience to their customers.


alexzuniga_0-1688394232172.png

 



Azure Logic Apps Capabilities for Mainframe and Midranges Integration


Learn about the ways how Azure Logic Apps integrates with Mainframes and Midranges and why it is important for our Mission Critical customers!


alexzuniga_1-1688394352266.png

 



Data Mapper Patterns: Regular Expressions  


In this post you’ll learn how we can use Regular Expression functions in the new Data Mapper that helps us validate and transform data to ensure of data consistency.


alexzuniga_2-1688394476421.png

 


 



Expose your data from Azure Cosmos DB or Azure SQL through a GraphQL API with Azure API Management  


This article outlines the process of providing secure and controlled access and exposing data from Azure Cosmos DB or Azure SQL by utilizing Azure API Management.



alexzuniga_0-1688394232172.png



New Azure Integration Services Blog! 


We are excited to announce the consolidation of our BizTalk Server, Host Integration Server and Azure Logic Apps Blogs into the Azure Integration Services Blog


alexzuniga_4-1688395010857.png

 



.NET Framework Custom Code in Azure Logic Apps (Standard) – Troubleshooting Strategies


In this post, we are going to discuss some troubleshooting strategies that you can use when developing custom code solutions in Azure Logic Apps (Standard).


alexzuniga_5-1688395245131.png

 



Azure Logic Apps Community Day – On Demand Resources


If you missed Aviators Day or simply want to watch some sessions again, head on over to this post with links to the full day’s recordings. 


alexzuniga_6-1688395429762.png

 



.NET Framework Custom Code – Calling Existing Assemblies


In the .NET Framework Custom Code post, we discussed how to author code and debug it. We now want to expand upon that scenario and discuss how we can call an existing assembly from our custom code project.



 




News from our community:


Microsoft Previews .NET Framework Custom Code for Azure Logic Apps Standard


Post by Steef-Jan Wiggers


 


Read more about the public preview for .NET Framework Custom Code from Aviator’s own Steef-Jan!


 


Resolving 401 “Forbidden” Error When Deploying Logic Apps ARM Template


Post by Harris Kristanto


 


Harris discusses the issue of encountering a 401 Forbidden error during the deployment of Logic Apps ARM templates and provides steps to resolve it. Learn the potential causes of the error and suggests troubleshooting methods, including adjusting authentication settings and ensuring proper access permissions are set, to successfully deploy the Logic Apps template.


 


Compare Azure Messaging Services | How to Chose | Azure Service Bus vs Event Hub vs Event Grid


Post by Srikanth Gunnala


 


In this video Srikanth discusses Azure Messaging Services’ three most utilized components: Azure Service Bus, Azure Event Grid, and Azure Event Hub. See real-world applications and demonstrations on how these services ensure smooth communication between different parts of a software program.


 


Mastering GraphQL Resolvers for Cosmos DB


Post by Ryan Langford


 


Developers looking for more cloud skills should read Ryan’s post on mastering GraphQL Resolvers in Azure Cosmos DB. He covers everything from setting up your API Manager Instance to querying and mutating the graph in Azure Cosmos DB.

Boosting Productivity: Unleashing the Power of Dynamics 365 for Prospect-to-Cash Efficiency

Boosting Productivity: Unleashing the Power of Dynamics 365 for Prospect-to-Cash Efficiency

This article is contributed. See the original author and article here.

Introduction

Companies seek efficiency in their customer engagement activities. Front office salespeople, traveling sales representatives, account managers, and others need to engage efficiently with customers while using Dynamics 365 Sales without spending time to ensure that data flows efficiently between their front-office work environment and the Dynamics 365 Supply Chain Management back-office environment. True end-to-end process integration must work seamlessly across applications, using an integrated process flow from quotation to invoice, to help businesses drive efficiencies in their sales and fulfilment processes, improve accuracy, and reduce lead times.

We are excited to announce the general availability of a set of new features and capabilities that will enhance the efficiency of the prospect-to-cash integration between Dynamics 365 Sales and Dynamics 365 Supply Chain Management. These additions to the prospect-to-cash integration aim to improve efficiency and cover several new features in Dynamics 365 Supply Chain Management 10.0.34, as well as a new Dual-write Supply Chain solution version 2.3.4.203.

This new feature set enables businesses to achieve true end-to-end process support and unlock various benefits. In this blog post, we will briefly showcase and explain the advantages that companies can gain by leveraging this feature set in an integrated scenario between Dynamics 365 Sales and Dynamics 365 Supply Chain Management.

Integrate Sales Quotation Lifecycle

Sales quotations can be created and processed throughout their lifecycle in both Dynamics 365 Sales and Dynamics 365 SCM. It is crucial that when a sales quotation is processed in one application, it is accurately reflected in the other application. Let’s consider a scenario where Dynamics 365 Sales serves as the CRM application. Salespeople utilize Dynamics 365 Sales to create, edit, collaborate on, and communicate sales quotations with customers. From a back-office perspective, it is essential for these sales quotations to be visible in Dynamics 365 SCM. This visibility allows for insights into expected demand, supporting back-office supply planning.

Furthermore, it is equally important for these sales quotations to be accessible in Dynamics 365 SCM to enable collaboration between back-office staff and front-office salespeople. This collaboration enhances sales quotations by incorporating necessary information that only back-office staff possess insights into. Lastly, but certainly not least, it is critical that when a sales quotation is activated and communicated to the customer by the front-office, this event triggers the appropriate quotation update in Dynamics 365 SCM.

With our new feature set, we now allow for such an integrated scenario with fewer touch points, better efficiency, and improved transparency.

Key benefits of this feature include:

End-to-end quotation lifecycle integration:

The sales quotation process can be initiated in either Dynamics 365 Sales or Dynamics 365 SCM and completed in either application, ensuring that changes and lifecycle updates seamlessly flow between both applications. This eliminates the need for manual duplication of sales quotation data and processing.

Unambiguous and transparent quotation lifecycle processing:

With the introduction of new concepts of origin and ownership, it is always clear and transparent which application is responsible for processing the sales quotation. This eliminates human errors in the quotation process.

Reduced cost of ownership:

The end-to-end lifecycle integration is supported without the need for customizations, resulting in reduced costs of ownership.

The integrated sales quotation lifecycle is supported by Dual-write Supply Chain solution version 2.3.4.203 and the following Dynamics 365 SCM 10.0.34 features: Integrate Sales Quotation lifecycle with Dynamics 365 Sales, Copy Supply Chain Management sales quotation data to sales orders synced from Dynamics 365 Sales, Set default ownership for sales quotations when integrated with Dynamics 365 Sales.

To learn more about these features, follow the link:

Add efficiency in quote-to-cash with Dynamics 365 Sales – Finance & Operations | Dynamics 365 | Microsoft Learn

Integrate Pricing

Before the release of Dual-write Supply Chain solution version 2.3.4.203, in conjunction with Dynamics 365 SCM 10.0.34, the recommended method for integrating pricing between the two applications was to configure Dynamics 365 Sales to utilize the system price calculation. This setup, coupled with the synchronization of totals and subtotals from Dynamics 365 SCM to Dynamics 365 Sales, along with the utilization of price quote and price order actions in Dynamics 365 Sales, as well as the implementation of manual discounts in Dynamics 365 Sales, could lead to a loss of transparency. This lack of transparency pertains to identifying which application controls and calculates the monetary values associated with sales quotations and sales orders, including prices, discounts, subtotals, and totals.

In Dynamics 365 SCM 10.0.34, we introduce two features to simplify and enhance transparency in calculations related to price, discount, subtotal, and total when integrating with Dynamics 365 Sales. The first feature is to designate Supply Chain Management as the price master when integrated with Dynamics 365 Sales. The second feature enables the calculation and pushing of prices, discounts, and totals specifically for selective sales orders and sales quotations when integrated with Dynamics 365 Sales.

Key benefits of these features include:

  • Calculations for extended amounts, summary amounts, subtotals, and totals for sales quotations and sales orders are not performed in Dynamics 365 Sales; All calculated monetary fields are calculated in and synchronized from Supply Chain Management.
  • Front-office salespeople can now, if authorized, manually apply a discount from Dynamics 365 Sales which is fully integrated with discounts in Dynamics 365 SCM.
  • Back-office staff can now calculate and push, whenever needed, all price and discount related updates for one or more sales quotation and sales orders from Dynamics 365 SCM to Dynamics 365 Sales.

To learn more about these features, follow the link: 

Work with added efficiency in quote-to-cash with Dynamics 365 Sales – Finance & Operations | Dynamics 365 | Microsoft Learn

Asynchronous or synchronous processing of events

Front-office salespeople using Dynamics 365 Sales need to work efficiently on quotations and sales orders without unnecessary wait times. They also need to maintain efficiency when Dynamics 365 Sales is integrated with Dynamics 365 SCM. The same applies to back-office staff working on quotations and sales orders in Dynamics 365 SCM. Achieving a smooth user experience and efficiency in these tasks heavily relies on asynchronous processing of events.

Asynchronous processing of Sales-integrated events allows events to be processed asynchronously in Dynamics 365 SCM using the message processor framework. This approach significantly enhances the user experience and performance of sales order and sales quotation integration in various use cases.

  • Front-office salespeople in Dynamics 365 Sales activates a quotation. This event will update the Sales Quotation in Dynamics 365 SCM to Sent and create a quotation journal.
  • Front-office salespeople in Dynamics 365 Sales creates an order from a sales quotation won. This event will update the Sales Quotation in Dynamics 365 SCM to Won, create a quotation confirmation journal, link the resulting sales order with the sales quotation, and, if setup, copy sales quotation data from the Dynamics 365 SCM sales quotation to the Dynamics 365 SCM sales order, and synchronize the changes to the sales order in Dynamics 365 Sales.
  • Back-office staff in Dynamics 365 SCM recalculates and pushes prices and totals for one or more sales quotations and sales orders to Dynamics 365 Sales

Key benefits of this feature include:

  • The user experience of front-office salespeople in Dynamics 365 Sales will not be impacted any additional time it may take to process integration related events.
  • Companies can flexibly decide which events to be processed synchronously and which to be processed asynchronously to provide the optimum user experience.
  • Improved system performance which will have a positive impact on user experience in both applications.

To learn more about this feature and Supply Chain at Microsoft, click below:

Feature Insights:

Work with added efficiency in quote-to-cash with Dynamics 365 Sales – Finance & Operations | Dynamics 365 | Microsoft Learn

Supply Chain at Microsoft

Take a tour – Supply Chain Management | Microsoft Dynamics 365

We’re excited to launch Free Trial | Microsoft Supply Chain Center Preview ,  which harnesses generative AI to assist Supply Chain managers in real-time communication with suppliers regarding specific news

The post Boosting Productivity: Unleashing the Power of Dynamics 365 for Prospect-to-Cash Efficiency appeared first on Microsoft Dynamics 365 Blog.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.

Lesson Learned #388:Retrying Execution in case of Connection Drops/Command Timeouts using ODBC API

This article is contributed. See the original author and article here.

Based on Lesson Learned #368: Connection Retry-Logic using ODBC API code – Microsoft Community Hub I would like to share but was my lesson learned execution TSQL command. Executing a TSQL command connectivity issues or command timeouts can occur, leading to failed executions. To overcome these challenges, it is essential to implement robust error-handling mechanisms. In this article, we will explore how to leverage the ODBC API to retry the execution of TSQL commands when faced with connection drops or command timeouts. 


 


Implementing a Retry Mechanism: The following steps outline how to implement a retry mechanism using the ODBC API.


 




  1. Catch the error: Surround the TSQL command execution with a try-catch block or equivalent error-handling mechanism. In the catch block, examine the error code or exception to identify connection drops or command timeouts.




  2. Determine the retry conditions: Define the conditions under which a retry should occur. For example, you might retry when the error code corresponds to a dropped connection (e.g., SQLSTATE 08S01) or a command timeout (e.g., SQLSTATE HYT00).




  3. Set a maximum retry limit: To prevent infinite retries, set a maximum retry limit. It is essential to strike a balance between allowing enough retries to handle temporary issues and avoiding prolonged execution times.




  4. Introduce a delay between retries: To avoid overwhelming the database server, introduce a delay between retries. Exponential backoff is a popular technique where the delay increases exponentially after each retry, allowing the server time to recover.




  5. Retry the execution: Once the retry conditions are met, re-execute the TSQL command using the same connection. Remember to handle any additional exceptions that may arise during the retry process.




  6. Track retries: Keep track of the number of retries attempted to monitor the effectiveness of the retry mechanism. This information can be useful for troubleshooting and optimizing the system.




Code


 


 


 

        public void MainRetry()
        {
            // Initialize ODBC environment handle
            IntPtr environmentHandle = IntPtr.Zero;
            String sErrorMsg = "";
            Boolean bExecution = false;
            SQLAllocHandle(1, IntPtr.Zero, out environmentHandle);
            //SQLSetEnvAttr(environmentHandle, 201, (IntPtr)2, 0);
            SQLSetEnvAttr(environmentHandle, 200, (IntPtr)380, 0);

            bExecution = bMainRetryExecution(environmentHandle, ref sErrorMsg,"WAITFOR DELAY '00:02:50'",4 );
            if(!bExecution)
            {
                Console.WriteLine("Error: " + sErrorMsg);
            }
            else
            {
                Console.WriteLine("Execution correctly");
            }
            SQLFreeHandle(1, environmentHandle);
        }

        public Boolean bMainRetryExecution(IntPtr environmentHandle, 
                                           ref string sErrorMsg, 
                                           string sQuery = "SELECT 1", 
                                           int iRetryCount = 1)
        {
            // Initialize ODBC connection and statement handles
            Boolean bExecute = false;
            int retryIntervalSeconds = 2;

            for (int i = 1; i <= iRetryCount; i++)
            {
                try
                {
                    IntPtr connectionHandle = IntPtr.Zero;
                    IntPtr statementHandle = IntPtr.Zero;
                    int retcode;

                    Console.WriteLine("Try to execute {0} of {1} Query: {2}", i, iRetryCount, sQuery); 
                    retcode = SQLAllocHandle(2, environmentHandle, out connectionHandle);
                    if (retcode == -1)
                    {
                        sErrorMsg = "Not possible to obtain the environment Handle";
                    }
                    else
                    {
                      if (RetryLogicUsingODBCAPI(connectionHandle) == -1)
                      {
                            sErrorMsg = "Connection was not possible after the retries";
                      }
                      else
                      {
                            retcode = SQLAllocHandle(3, connectionHandle, out statementHandle);
                            if (retcode == -1)
                            {
                                sErrorMsg = "Not possible to obtain the statementHandle";
                            }
                            else
                            {
                                SQLSetStmtAttr(statementHandle, SQL_ATTR_QUERY_TIMEOUT, (IntPtr)(30*(i)), 0);
                                retcode = SQLExecDirect(statementHandle, sQuery, sQuery.Length);
                                if (retcode == -1)
                                {
                                    GetODBCErrorDetails(statementHandle, 3);
                                    sErrorMsg = "Error: not possible to execute the query.";
                                    System.Threading.Thread.Sleep(1000 * retryIntervalSeconds);
                                    retryIntervalSeconds = Convert.ToInt32(retryIntervalSeconds * 1.5);
                                }
                                else
                                {
                                    SQLDisconnect(connectionHandle);
                                    SQLFreeHandle(3, statementHandle);
                                    SQLFreeHandle(2, connectionHandle);
                                    sErrorMsg = "Command executed correctly";
                                    bExecute = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                  Console.WriteLine("Error: " + ex.Message);
                  sErrorMsg = "Error: " + ex.Message;
                }
            }
            return bExecute;
        }

 


 


 


Explanation:


 












The script demonstrates a retry mechanism for executing TSQL commands using the ODBC API. Let’s go through the code step by step:




  1. MainRetry() is the entry point method. It initializes the ODBC environment handle (environmentHandle) using the SQLAllocHandle() function. The SQLSetEnvAttr() function is called to set an attribute related to query execution time. Then, it calls the bMainRetryExecution() method to perform the actual execution.




  2. bMainRetryExecution() is the method responsible for executing the TSQL command and handling retries. It takes the ODBC environment handle (environmentHandle), an error message string (sErrorMsg), the TSQL query string (sQuery), and the number of retry attempts (iRetryCount) as parameters.




  3. Inside the method, a loop is set up to attempt the execution multiple times based on the specified iRetryCount. The loop starts with i set to 1 and continues until it reaches iRetryCount.




  4. Within each iteration of the loop, the method attempts to execute the TSQL command. It first initializes the ODBC connection handle (connectionHandle) using SQLAllocHandle().




  5. If obtaining the connection handle fails (retcode == -1), an error message is set, indicating the inability to obtain the environment handle.




  6. If obtaining the connection handle is successful, the method calls RetryLogicUsingODBCAPI() to handle the retry logic for the connection. The details of this method are not provided in the code snippet, but it likely includes connection establishment and retry mechanisms specific to the application. You could find more information here: Lesson Learned #368: Connection Retry-Logic using ODBC API code – Microsoft Community Hub




  7. Once the retry logic completes, the method proceeds to allocate the ODBC statement handle (statementHandle) using SQLAllocHandle(). If the allocation fails, an error message is set.




  8. If the statement handle is successfully allocated, the method sets the query timeout attribute using SQLSetStmtAttr(), adjusting the timeout value based on the current retry attempt (30*(i)). 




  9. The TSQL command is then executed using SQLExecDirect() with the statement handle and the provided query string. If the execution fails (retcode == -1), the GetODBCErrorDetails() method is likely called to retrieve specific error information. The code sets an appropriate error message in the sErrorMsg variable, waits for a specified interval using Thread.Sleep(), and increases the retry interval by multiplying it by 1.5. Of course, we could capture the error and depending if the execution and provide other ways to react , also, remember that the connection would be re-stablished – Lesson Learned #381: The connection is broken and recovery is not possible message using API ODBC – Microsoft Community Hub




  10. If the execution succeeds, the code disconnects from the database, frees the statement and connection handles using SQLDisconnect(), SQLFreeHandle(), and SQLFreeHandle(), respectively. It sets a success message in sErrorMsg, sets bExecute to true, and breaks out of the retry loop. 




  11. Finally, the method catches any exceptions that occur during the execution and sets the error message accordingly.




  12. The method returns the bExecute flag to indicate whether the execution was successful (true) or not (false).




The provided code showcases a basic retry mechanism utilizing the ODBC API for executing TSQL commands.