In this article, we will learn how to update an account in Quickbooks online from .NET MVC web application using SDK.
Before using any Quickbooks online API we need access token, if you don’t know how to get access token then you can find it here.
public ActionResult UpdateAccount() { try { OAuth2RequestValidator oauthValidator = new OAuth2RequestValidator(Access_token); // Create a ServiceContext with Auth tokens and realmId ServiceContext serviceContext = new ServiceContext(RealmId, IntuitServicesType.QBO, oauthValidator); serviceContext.IppConfiguration.MinorVersion.Qbo = "23"; serviceContext.IppConfiguration.BaseUrl.Qbo = QboBaseUrl; string EXISTING_ACCOUNT_QUERYBYNAME = string.Format("select * from Account where Name = '{0}'", "Tabish Income Account"); var queryService = new QueryService<Account>(serviceContext); Account ObjAccountFound = queryService.ExecuteIdsQuery(EXISTING_ACCOUNT_QUERYBYNAME).FirstOrDefault<Account>(); //If Account found on Quickbooks online if (ObjAccountFound != null) { Account ObjAccount = new Account(); ObjAccount.Id = ObjAccountFound.Id; ObjAccount.SyncToken = ObjAccountFound.SyncToken; ObjAccount.Name = "Tabish Vision Income Account"; ObjAccount.AccountTypeSpecified = true; ObjAccount.AccountType = ObjAccountFound.AccountType; DataService dataService = new DataService(serviceContext); Account UpdateEntity = dataService.Update<Account>(ObjAccount); if (UpdateEntity != null && !string.IsNullOrEmpty(UpdateEntity.Id)) { //you can write Database code here ViewBag.IsSuccess = true; } } return View(); } catch (IdsException ex) { return View(); } catch (Exception ex) { return View(); } }
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular