I'm using Microsoft.Xrm.Sdk to interact with Dynamics CRM On-Premise. What I want to do is insert a post into Lead entity social pane posts via API.
What I did is as below:
var _crmUrl = _configuration.GetSection("Crm:Url").Value;
var _organizationName = _configuration.GetSection("Crm:Org").Value;
var clientCredentials = new System.ServiceModel.Description.ClientCredentials();
clientCredentials.Windows.ClientCredential.UserName = _configuration.GetSection("Crm:user").Value;
clientCredentials.Windows.ClientCredential.Password = _configuration.GetSection("Crm:pass").Value;
var crm = new OrganizationServiceProxy($"{_crmUrl}{_organizationName}", clientCredentials.Windows.ClientCredential);
Microsoft.Xrm.Sdk.Query.ColumnSet columns = new Microsoft.Xrm.Sdk.Query.ColumnSet() { AllColumns = true };
var entity = await crm.RetrieveAsync("lead", new Guid(model.Id), columns, CancellationToken.None);
// INSERT POST TO entity
await crm.UpdateAsync(entity, CancellationToken.None);
Is it possible to insert posts using XRM SDK?
Yes, this is possible! The schema name that you're looking for is
post
To create a new
post
record should be straightforward as you already have your connection:Continuing this, you can create your new
post
record:The
source
column refers to whether thepost
was created automatically or manually. See Microsoft Documentation.and then save the record