9 Aralık 2015 Çarşamba

CRM 2011 QueryExpression - Firma Çekme (Get Account)

  public static Account GetAccount(IOrganizationService ser, Guid accountid, ColumnSet columnset)
        {
            try
            {
                QueryExpression query = GetQueryExpressionSingle("account", "accountid", accountid, columnset);
                EntityCollection ec = ser.RetrieveMultiple(query);
                if (ec != null && ec.Entities.Count == 1)
                    return (Account)ec.Entities[0];
                else
                    return new Account();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

GetQueryExpressionSingle metodu


Metot Kullanımı

Account account = CrmManagerStatic.GetAccount(crmService, accountId, new ColumnSet(new string[] { "accountid", "name" }));
                        if (account != null && account.Id != Guid.Empty)
                        {

                       }

Hiç yorum yok:

Yorum Gönder