/// <summary> /// helper method to setup the request track-changes header /// </summary> /// <param name="Request"></param> /// <param name="QueryOptions"></param> private void FillPreferHeader(HttpRequestMessage Request, CRMGetListOptions QueryOptions) { if (QueryOptions == null) { return; } var preferList = new List <string>(); if (QueryOptions.IncludeAnnotations) { preferList.Add("odata.include-annotations=\"*\""); } else if (QueryOptions.FormattedValues) { preferList.Add("odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\""); } if (QueryOptions.TrackChanges) { preferList.Add("odata.track-changes"); } // preferList.Add("odata.maxpagesize=1"); if (preferList.Count > 0) { Request.Headers.Add("Prefer", string.Join(",", preferList)); } }
public static async Task GetAccountCounts(CRMWebAPI api, ITurnContext <IMessageActivity> context) { await Task.Run(async() => { dynamic whoamiResults = await api.ExecuteFunction("WhoAmI"); var opt = new CRMGetListOptions { Top = 5000, Filter = "_createdby_value eq " + whoamiResults.UserId + " or _modifiedby_value eq " + whoamiResults.UserId }; var count = await api.GetList("accounts", QueryOptions: opt); if (count == null) { count = new Xrm.Tools.WebAPI.Results.CRMGetListResult <ExpandoObject>(); count.List = new List <ExpandoObject>(); } else if (count.List == null) { count.List = new List <ExpandoObject>(); } var card = new HeroCard(); var action = new CardAction() { Type = ActionTypes.MessageBack, Title = $"Accounts owned by me: {count.List.Count}", Value = count.ToString() }; card.Buttons = new List <CardAction>(); card.Buttons.Add(action); await DisplayMessage(card, context); }); }
public static async Task <List <CRMAttributeDisplayName> > GetAttributeDisplayNameList(this CRMWebAPI api, Guid entityID, int LCID = 0) { var result = new List <CRMAttributeDisplayName>(); CRMGetListOptions options = new CRMGetListOptions() { Filter = "((IsValidForRead eq true) and (AttributeOf eq null))", Select = new[] { "MetadataId", "DisplayName", "LogicalName", "SchemaName", "AttributeType", "IsPrimaryId" } }; var queryResults = await api.GetList("EntityDefinitions(" + entityID.ToString() + ")/Attributes", options); foreach (dynamic attrib in queryResults.List) { CRMAttributeDisplayName edm = new CRMAttributeDisplayName(); edm.MetadataId = Guid.Parse(attrib.MetadataId); edm.LogicalName = attrib.LogicalName; edm.SchemaName = attrib.SchemaName; edm.IsPrimaryId = attrib.IsPrimaryId; edm.AttributeType = attrib.AttributeType; if (attrib.AttributeType == "Lookup" || attrib.AttributeType == "Customer" || attrib.AttributeType == "Owner") { edm.ODataLogicalName = "_" + attrib.LogicalName + "_value"; } else { edm.ODataLogicalName = attrib.LogicalName; } if ((attrib.DisplayName.LocalizedLabels != null) && (attrib.DisplayName.LocalizedLabels.Count > 0)) { edm.DisplayName = attrib.DisplayName.LocalizedLabels[0].Label; if (LCID != 0) { foreach (dynamic label in attrib.DisplayName.LocalizedLabels) { if (label.LanguageCode == LCID) { edm.DisplayName = label.Label; } } } } else { edm.DisplayName = edm.LogicalName; } edm.LogicalDisplayName = edm.DisplayName + "(" + edm.LogicalName + ")"; result.Add(edm); } return(result); }
/// <summary> /// Retrieve a list of records based on query options /// </summary> /// <param name="uri">e.g. accounts</param> /// <param name="QueryOptions">Filter, OrderBy,Select, and other options</param> /// <returns></returns> public async Task <CRMGetListResult <ExpandoObject> > GetList(string uri, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); string fullUrl = BuildGetUrl(uri, QueryOptions); HttpRequestMessage request = new HttpRequestMessage(new HttpMethod("GET"), fullUrl); if ((QueryOptions != null) && (QueryOptions.FormattedValues)) { request.Headers.Add("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\""); } var results = await _httpClient.SendAsync(request); EnsureSuccessStatusCode(results); var data = await results.Content.ReadAsStringAsync(); CRMGetListResult <ExpandoObject> resultList = new CRMGetListResult <ExpandoObject>(); resultList.List = new List <ExpandoObject>(); var values = JObject.Parse(data); var valueList = values["value"].ToList(); foreach (var value in valueList) { resultList.List.Add(value.ToObject <ExpandoObject>()); } var nextLink = values["@odata.nextLink"]; var recordCount = values["@odata.count"]; if (recordCount != null) { resultList.Count = int.Parse(recordCount.ToString()); } while (nextLink != null) { var nextResults = await _httpClient.GetAsync(nextLink.ToString()); EnsureSuccessStatusCode(nextResults); var nextData = await nextResults.Content.ReadAsStringAsync(); var nextValues = JObject.Parse(nextData); var nextValueList = nextValues["value"].ToList(); foreach (var nextvalue in nextValueList) { resultList.List.Add(nextvalue.ToObject <ExpandoObject>()); } nextLink = nextValues["@odata.nextLink"]; } return(resultList); }
private void BuildExpandQueryURLOptions(CRMGetListOptions queryOptions, ref string fullurl, ref bool firstParam) { List <string> expands = new List <string>(); foreach (var expand in queryOptions.Expand) { List <string> expandOptions = new List <string>(); if (expand.Select != null) { expandOptions.Add(String.Format("$select={0}", String.Join(",", expand.Select))); } if (expand.OrderBy != null) { expandOptions.Add(String.Format("$orderby={0}", String.Join(",", expand.OrderBy))); } if (expand.Filter != null) { expandOptions.Add("$filter=" + expand.Filter); } if (expand.Top > 0) { expandOptions.Add(string.Format("$top={0}", expand.Top)); } if (expandOptions.Count > 0) { expands.Add(string.Format("{0}({1})", expand.Property, string.Join(";", expandOptions))); } else { expands.Add(string.Format("{0}", expand.Property)); } } if (expands.Count > 0) { if (firstParam) { fullurl = fullurl + string.Format("?$expand={0}", String.Join(",", expands)); } else { fullurl = fullurl + string.Format("&$expand={0}", String.Join(",", expands)); } firstParam = false; } }
/// <summary> /// Get count of matching records. /// /// Note: This returns up to 5,000 records matching criteria it will not reflect all records over 5,000 due to /// a limitiation with CRM internal handling of retrieval of the count /// </summary> /// <param name="uri">e.g. accounts</param> /// <param name="QueryOptions">Filter, OrderBy,Select, and other options</param> /// <returns></returns> public async Task <int> GetCount(string uri, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); if (QueryOptions != null) { QueryOptions.IncludeCount = false; } string fullUrl = BuildGetUrl(uri + "/$count", QueryOptions); var results = await _httpClient.GetAsync(fullUrl); EnsureSuccessStatusCode(results); var data = await results.Content.ReadAsStringAsync(); return(int.Parse(data)); }
/// <summary> /// Retrieve a list of records based on query options /// </summary> /// <param name="uri">e.g. accounts</param> /// <param name="QueryOptions">Filter, OrderBy,Select, and other options</param> /// <returns></returns> public async Task <CRMGetListResult <ExpandoObject> > GetList(string uri, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); string fullUrl = BuildGetUrl(uri, QueryOptions); var results = await _httpClient.GetAsync(fullUrl); results.EnsureSuccessStatusCode(); var data = await results.Content.ReadAsStringAsync(); CRMGetListResult <ExpandoObject> resultList = new CRMGetListResult <ExpandoObject>(); resultList.List = new List <ExpandoObject>(); var values = JObject.Parse(data); var valueList = values["value"].ToList(); foreach (var value in valueList) { resultList.List.Add(value.ToObject <ExpandoObject>()); } var nextLink = values["@odata.nextLink"]; var recordCount = values["@odata.count"]; if (recordCount != null) { resultList.Count = int.Parse(recordCount.ToString()); } while (nextLink != null) { var nextResults = await _httpClient.GetAsync(nextLink.ToString()); nextResults.EnsureSuccessStatusCode(); var nextData = await nextResults.Content.ReadAsStringAsync(); var nextValues = JObject.Parse(nextData); var nextValueList = nextValues["value"].ToList(); foreach (var nextvalue in nextValueList) { resultList.List.Add(nextvalue.ToObject <ExpandoObject>()); } nextLink = nextValues["@odata.nextLink"]; } return(resultList); }
public async Task TestFetchXml() { var api = GetAPI(); CRMGetListOptions qOptions = new CRMGetListOptions() { FetchXml = @"<fetch no-lock='true'><entity name='account'><attribute name='accountid'/><attribute name='name'/><attribute name='accountnumber'/><filter type='and'></filter><link-entity name='contact' from='contactid' to='primarycontactid' link-type='inner' alias='contact'><attribute name='fullname'/></link-entity></entity></fetch>" }; var accounts = await api.GetList("accounts", qOptions); foreach (dynamic account in accounts.List) { var myAccount = account as IDictionary <string, object>; Console.WriteLine(myAccount["contact.fullname"]); } System.Diagnostics.Trace.WriteLine("finished"); }
public static async Task <ExpandoObject> GetOptionSetByName(this CRMWebAPI api, string optionSetName) { CRMGetListOptions options = new CRMGetListOptions() { Select = new[] { "Name" } }; var queryResult = await api.GetList("GlobalOptionSetDefinitions", options); foreach (dynamic optionSet in queryResult.List) { if ((optionSet != null) && (optionSet.Name == optionSetName)) { var matchingOptionSet = await api.Get("GlobalOptionSetDefinitions", Guid.Parse(optionSet.MetadataId)); return(matchingOptionSet); } } return(null); }
private static void BuildAdvancedQueryURLOptions(CRMGetListOptions queryOptions, ref string fullurl, ref bool firstParam) { if (queryOptions.SystemQuery != Guid.Empty) { if (firstParam) { fullurl = fullurl + string.Format("?savedQuery={0}", queryOptions.SystemQuery.ToString()); } else { fullurl = fullurl + string.Format("&savedQuery={0}", queryOptions.SystemQuery.ToString()); } firstParam = false; } if (queryOptions.UserQuery != Guid.Empty) { if (firstParam) { fullurl = fullurl + string.Format("?userQuery={0}", queryOptions.UserQuery.ToString()); } else { fullurl = fullurl + string.Format("&userQuery={0}", queryOptions.UserQuery.ToString()); } firstParam = false; } if (!string.IsNullOrEmpty(queryOptions.FetchXml)) { if (firstParam) { fullurl = fullurl + string.Format("?fetchXml={0}", Uri.EscapeUriString(queryOptions.FetchXml)); } else { fullurl = fullurl + string.Format("&fetchXml={0}", Uri.EscapeUriString(queryOptions.FetchXml)); } firstParam = false; } }
public void TestExpandQuery() { Task.Run(async() => { var api = GetAPI(); dynamic whoamiResults = await api.ExecuteFunction("WhoAmI"); CRMGetListOptions userOptions = new CRMGetListOptions() { Expand = new CRMExpandOptions[] { new CRMExpandOptions() { Property = "businessunitid", Select = new string[] { "businessunitid", "name", "websiteurl" } } } }; var userResults = await api.Get("systemusers", Guid.Parse(whoamiResults.UserId), QueryOptions: userOptions); CRMGetListOptions buOptions = new CRMGetListOptions() { Expand = new CRMExpandOptions[] { new CRMExpandOptions() { Property = "business_unit_system_users", Select = new string[] { "systemuserid", "fullname" }, Filter = "systemuserid ne " + whoamiResults.UserId, OrderBy = new string[] { "createdon asc" }, Top = 5 } } }; var buResult = await api.Get("businessunits", Guid.Parse(userResults.businessunitid.businessunitid), QueryOptions: buOptions); dynamic userCount = buResult.business_unit_system_users.Count; System.Diagnostics.Trace.WriteLine("finished"); }).Wait(); }
/// <summary> /// get a single record with the specified return type /// </summary> /// <typeparam name="ResultType"></typeparam> /// <param name="uri"></param> /// <param name="QueryOptions"></param> /// <returns></returns> public async Task <ResultType> Get <ResultType>(string entityCollection, Guid entityID, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); string fullUrl = string.Empty; if (entityID == Guid.Empty) { fullUrl = BuildGetUrl(entityCollection, QueryOptions); } else { fullUrl = BuildGetUrl(entityCollection + "(" + entityID.ToString() + ")", QueryOptions); } HttpRequestMessage request = new HttpRequestMessage(new HttpMethod("GET"), fullUrl); if ((QueryOptions != null) && (QueryOptions.FormattedValues)) { request.Headers.Add("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\""); } var results = await _httpClient.SendAsync(request); EnsureSuccessStatusCode(results); var data = await results.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ResultType>(data)); }
/// <summary> /// Retrieve a list of records based on query options /// </summary> /// <typeparam name="ResultType"></typeparam> /// <param name="uri">e.g. accounts</param> /// <param name="QueryOptions">Filter, OrderBy,Select, and other options</param> /// <returns></returns> public async Task <CRMGetListResult <ResultType> > GetList <ResultType>(string uri, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); string fullUrl = BuildGetUrl(uri, QueryOptions); HttpRequestMessage request = new HttpRequestMessage(new HttpMethod("GET"), fullUrl); FillPreferHeader(request, QueryOptions); var results = await _httpClient.SendAsync(request); EnsureSuccessStatusCode(results); var data = await results.Content.ReadAsStringAsync(); var values = JObject.Parse(data); CRMGetListResult <ResultType> resultList = new CRMGetListResult <ResultType>(); resultList.List = new List <ResultType>(); foreach (var value in values["value"].ToList()) { if (_crmWebAPIConfig.ResolveUnicodeNames) { FormatResultProperties((JObject)value); } resultList.List.Add(value.ToObject <ResultType>()); } var deltaLink = values["@odata.deltaLink"]; if (deltaLink != null) { resultList.TrackChangesLink = deltaLink.ToString(); } var nextLink = values["@odata.nextLink"]; var recordCount = values["@odata.count"]; if (recordCount != null) { resultList.Count = int.Parse(recordCount.ToString()); } while (nextLink != null) { var nextResults = await _httpClient.GetAsync(nextLink.ToString()); EnsureSuccessStatusCode(nextResults); var nextData = await nextResults.Content.ReadAsStringAsync(); var nextValues = JObject.Parse(nextData); foreach (var value in nextValues["value"].ToList()) { resultList.List.Add(value.ToObject <ResultType>()); } nextLink = nextValues["@odata.nextLink"]; } return(resultList); }
public static async Task <List <CRMEntityDisplayName> > GetEntityDisplayNameList(this CRMWebAPI api, int LCID = 0) { var result = new List <CRMEntityDisplayName>(); CRMGetListOptions options = new CRMGetListOptions() { Filter = "IsPrivate eq false", Select = new[] { "MetadataId", "EntitySetName", "DisplayName", "DisplayCollectionName", "LogicalName", "LogicalCollectionName", "PrimaryIdAttribute" } }; var queryResults = await api.GetList("EntityDefinitions", options); foreach (dynamic entity in queryResults.List) { CRMEntityDisplayName edm = new CRMEntityDisplayName(); edm.MetadataId = Guid.Parse(entity.MetadataId); edm.EntitySetName = entity.EntitySetName; edm.LogicalName = entity.LogicalName; edm.LogicalCollectionName = entity.LogicalCollectionName; edm.PrimaryIdAttribute = entity.PrimaryIdAttribute; if ((entity.DisplayName.LocalizedLabels != null) && (entity.DisplayName.LocalizedLabels.Count > 0)) { edm.DisplayName = entity.DisplayName.LocalizedLabels[0].Label; if (LCID != 0) { foreach (dynamic label in entity.DisplayName.LocalizedLabels) { if (label.LanguageCode == LCID) { edm.DisplayName = label.Label; } } } } else { edm.DisplayName = edm.LogicalName; } if ((entity.DisplayCollectionName.LocalizedLabels != null) && (entity.DisplayCollectionName.LocalizedLabels.Count > 0)) { edm.DisplayCollectionName = entity.DisplayCollectionName.LocalizedLabels[0].Label; if (LCID != 0) { foreach (dynamic label in entity.DisplayCollectionName.LocalizedLabels) { if (label.LanguageCode == LCID) { edm.DisplayCollectionName = label.Label; } } } } else { edm.DisplayCollectionName = entity.LogicalCollectionName; } edm.LogicalDisplayName = edm.DisplayName + "(" + edm.LogicalName + ")"; edm.LogicalDisplayCollectionName = edm.DisplayCollectionName + "(" + edm.LogicalCollectionName + ")"; result.Add(edm); } return(result); }
public async Task <CRMGetListResult <ExpandoObject> > GetList(string url, CRMGetListOptions QueryOptions = null) { var result = await ApiClient.GetList(url, QueryOptions); return(result); }
/// <summary> /// get a single record by alternate or entityID key with the specified return type /// </summary> /// <typeparam name="ResultType"></typeparam> /// <param name="entityCollection"></param> /// <param name="key">Alternate key or entity ID</param> /// <param name="QueryOptions"></param> /// <returns></returns> public async Task <ResultType> Get <ResultType>(string entityCollection, string key, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); string fullUrl = string.Empty; if (key.Equals(Guid.Empty.ToString()) || String.IsNullOrEmpty(key)) { fullUrl = BuildGetUrl(entityCollection, QueryOptions); } else { fullUrl = BuildGetUrl(entityCollection + "(" + key + ")", QueryOptions); } HttpRequestMessage request = new HttpRequestMessage(new HttpMethod("GET"), fullUrl); if (QueryOptions != null) { if (QueryOptions.IncludeAnnotations) { request.Headers.Add("Prefer", "odata.include-annotations=\"*\""); } else if (QueryOptions.FormattedValues) { request.Headers.Add("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\""); } } var results = await _httpClient.SendAsync(request); EnsureSuccessStatusCode(results); var data = await results.Content.ReadAsStringAsync(); var value = JObject.Parse(data); if (_crmWebAPIConfig.ResolveUnicodeNames) { FormatResultProperties(value); } return(value.ToObject <ResultType>()); }
/// <summary> /// get a single record by entityID with the specified return type /// </summary> /// <param name="entityCollection"></param> /// <param name="entityID"></param> /// <param name="QueryOptions"></param> /// <returns>ExpandoObject</returns> public async Task <ExpandoObject> Get(string entityCollection, Guid entityID, CRMGetListOptions QueryOptions = null) { return(await Get <ExpandoObject>(entityCollection, entityID.ToString(), QueryOptions)); }
/// <summary> /// get a single record with the specified return type /// </summary> /// <typeparam name="ResultType"></typeparam> /// <param name="uri"></param> /// <param name="QueryOptions"></param> /// <returns></returns> public async Task <ResultType> Get <ResultType>(string entityCollection, Guid entityID, CRMGetListOptions QueryOptions = null) { await CheckAuthToken(); string fullUrl = BuildGetUrl(entityCollection + "(" + entityID.ToString() + ")", QueryOptions); var results = await _httpClient.GetAsync(fullUrl); results.EnsureSuccessStatusCode(); var data = await results.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ResultType>(data)); }
/// <summary> /// get a single record by entityID with the specified return type /// </summary> /// <param name="entityCollection"></param> /// <param name="entityID"></param> /// <param name="QueryOptions"></param> /// <returns></returns> public async Task <ResultType> Get <ResultType>(string entityCollection, Guid entityID, CRMGetListOptions QueryOptions = null) { return(await Get <ResultType>(entityCollection, entityID.ToString(), QueryOptions)); }
/// <summary> /// helper function to build query url /// </summary> /// <param name="uri"></param> /// <param name="queryOptions"></param> /// <returns></returns> private string BuildGetUrl(string uri, CRMGetListOptions queryOptions) { var fullurl = _apiUrl + uri; bool firstParam = true; if (queryOptions != null) { if (queryOptions.Select != null) { if (firstParam) { fullurl = String.Format("{0}?$select={1}", fullurl, String.Join(",", queryOptions.Select)); } else { fullurl = String.Format("{0}&$select={1}", fullurl, String.Join(",", queryOptions.Select)); } firstParam = false; } if (queryOptions.OrderBy != null) { if (firstParam) { fullurl = String.Format("{0}?$orderby={1}", fullurl, String.Join(",", queryOptions.OrderBy)); } else { fullurl = String.Format("{0}&$orderby={1}", fullurl, String.Join(",", queryOptions.OrderBy)); } firstParam = false; } if (queryOptions.Filter != null) { if (firstParam) { fullurl = fullurl + "?$filter=" + queryOptions.Filter; } else { fullurl = fullurl + "&$filter=" + queryOptions.Filter; } firstParam = false; } if (queryOptions.IncludeCount) { if (firstParam) { fullurl = fullurl + "?$count=true"; } else { fullurl = fullurl + "&$count=true"; } firstParam = false; } if (queryOptions.Skip > 0) { if (firstParam) { fullurl = fullurl + string.Format("?$skip={0}", queryOptions.Skip); } else { fullurl = fullurl + string.Format("&$skip={0}", queryOptions.Skip); } firstParam = false; } if (queryOptions.Top > 0) { if (firstParam) { fullurl = fullurl + string.Format("?$top={0}", queryOptions.Top); } else { fullurl = fullurl + string.Format("&$top={0}", queryOptions.Top); } firstParam = false; } if (queryOptions.Expand != null) { BuildExpandQueryURLOptions(queryOptions, ref fullurl, ref firstParam); } BuildAdvancedQueryURLOptions(queryOptions, ref fullurl, ref firstParam); } return(fullurl); }
/// <summary> /// helper function to build query url /// </summary> /// <param name="uri"></param> /// <param name="queryOptions"></param> /// <returns></returns> private string BuildGetUrl(string uri, CRMGetListOptions queryOptions) { var fullurl = _crmWebAPIConfig.APIUrl + uri; if (queryOptions != null) { bool firstParam = true; if (!string.IsNullOrEmpty(queryOptions.TrackChangesLink)) { fullurl = queryOptions.TrackChangesLink; firstParam = false; } if (queryOptions.Select != null) { if (firstParam) { fullurl = String.Format("{0}?$select={1}", fullurl, String.Join(",", queryOptions.Select)); } else { fullurl = String.Format("{0}&$select={1}", fullurl, String.Join(",", queryOptions.Select)); } firstParam = false; } if (queryOptions.OrderBy != null) { if (firstParam) { fullurl = String.Format("{0}?$orderby={1}", fullurl, String.Join(",", queryOptions.OrderBy)); } else { fullurl = String.Format("{0}&$orderby={1}", fullurl, String.Join(",", queryOptions.OrderBy)); } firstParam = false; } if (queryOptions.Filter != null) { if (firstParam) { fullurl = fullurl + "?$filter=" + queryOptions.Filter; } else { fullurl = fullurl + "&$filter=" + queryOptions.Filter; } firstParam = false; } if (queryOptions.Apply != null) { if (firstParam) { fullurl = fullurl + "?$apply=" + queryOptions.Apply; } else { fullurl = fullurl + "&$apply=" + queryOptions.Apply; } firstParam = false; } if (queryOptions.IncludeCount) { if (firstParam) { fullurl = fullurl + "?$count=true"; } else { fullurl = fullurl + "&$count=true"; } firstParam = false; } if (queryOptions.Skip > 0) { if (firstParam) { fullurl = fullurl + string.Format("?$skip={0}", queryOptions.Skip); } else { fullurl = fullurl + string.Format("&$skip={0}", queryOptions.Skip); } firstParam = false; } if (queryOptions.Top > 0) { if (firstParam) { fullurl = fullurl + string.Format("?$top={0}", queryOptions.Top); } else { fullurl = fullurl + string.Format("&$top={0}", queryOptions.Top); } firstParam = false; } if (queryOptions.Expand != null) { BuildExpandQueryURLOptions(queryOptions, ref fullurl, ref firstParam); } BuildAdvancedQueryURLOptions(queryOptions, ref fullurl, ref firstParam); } return(fullurl); }
public async Task <T> Get <T>(string entityCollectionName, Guid recordId, CRMGetListOptions QueryOptions = null) { var result = await ApiClient.Get <T>(entityCollectionName, recordId, QueryOptions); return(result); }