QuickBooks API SQL - 基于客户电子邮件地址查询

时间:2017-09-15 22:43:28

标签: c# quickbooks

我想通过电子邮件地址查询客户(使用 - 选择*来自客户,其中Email ='jdrew@myemail.com')但不清楚要在Quickbooks中引用哪一列来通过电子邮件选择客户。我是否使用PrimaryEmailAddr,Address,Email或PrimaryEmailAddr.Address。

下面的JSON在PrimaryEmailAddr中有一个嵌套值Address,所以我想清楚如何在QuickBooks API SQL查询中提取电子邮件地址的值。

通过电子邮件查找客户

var customerQueryService = new QueryService<Customer>(qboContextoAuth);
            Customer customer = customerQueryService.ExecuteIdsQuery("Select * From Customer Where PrimaryEmailAddr.Address = '" + user.Email + "' StartPosition 1 MaxResults 1").FirstOrDefault();

示例客户对象

{
    "BillAddr": {
        "Line1": "123 Main Street",
        "City": "Mountain View",
        "Country": "USA",
        "CountrySubDivisionCode": "CA",
        "PostalCode": "94042"
    },
    "Notes": "Here are other details.",
    "Title": "Mr",
    "GivenName": "James",
    "MiddleName": "B",
    "FamilyName": "King",
    "Suffix": "Jr",
    "FullyQualifiedName": "King Groceries",
    "CompanyName": "King Groceries",
    "DisplayName": "King's Groceries",
    "PrimaryPhone": {
        "FreeFormNumber": "(555) 555-5555"
    },
    "PrimaryEmailAddr": {
        "Address": "jdrew@myemail.com"
    }
}

1 个答案:

答案 0 :(得分:0)

原来我需要根据PrimaryEmailAddr进行查询(有人问我完全相同的问题),我在下面的Intuit开发者论坛的帖子中找到了。

https://help.developer.intuit.com/s/question/0D5G000004cXDFvKAO/query-customer-by-primaryemailadd