Exemple #1
0
        public async Task CreateCompanyPropertyGroupAsync(CrmPropertyGroup propertyGroup, CancellationToken cancellationToken = default)
        {
            // this isn't a field you set on CREATE
            propertyGroup.Archived = null;

            await CreateCrmPropertyGroupAsync("company", propertyGroup, cancellationToken);
        }
Exemple #2
0
        private async Task CreateCrmPropertyGroupAsync(string endpoint, CrmPropertyGroup propertyGroup, CancellationToken cancellationToken)
        {
            var json = JsonConvert.SerializeObject(propertyGroup, Formatting.Indented, new JsonSerializerSettings
            {
                ContractResolver = new DefaultContractResolver
                {
                    NamingStrategy = new CamelCaseNamingStrategy(),
                },
                NullValueHandling = NullValueHandling.Ignore,
            });

            using var content = new StringContent(json, Encoding.UTF8, "application/json");
            var response = await RequestWithRetriesAsync(
                async cancellationToken => await m_client.PostAsync($"/crm/v3/properties/{endpoint}/groups", content, cancellationToken),
                cancellationToken);

            await response.EnsureSuccessStatusCodeWithResponseBodyInException();
        }