// Create a new activity party linked to a contact
Entity party1 = new Entity("activityparty"); party1["addressused"] = "some@email.com"; party1["partyid"] = new EntityReference("contact", contactId); // Create a new unresolved activity party Entity party2 = new Entity("activityparty"); party2["addressused"] = "unresolved@email.com"; // Create a new EntityCollection and add the 2 parties EntityCollection to = new EntityCollection(); to.Entities.Add(party1); to.Entities.Add(party2); // Create an email with the EntityCollection Entity email = new Entity("email"); email["subject"] = "Test Party Lists"; email["to"] = to; Guid _emailid = service.Create(email);Power Platform, Microsoft Dynamics CRM 4.0, 2011, 2013, 2015, 2016, D365 CE, C#, ASP.net and MVC, Azure
Saturday, November 28, 2020
MSCRM Email Plugins C# with and Without CRM Reference
Monday, November 2, 2020
Mscrm Attachment with Seperate Folder
string root = @"D:\Business";
// If directory does not exist, create it.
if (!Directory.Exists(root))
{
Directory.CreateDirectory(root);
}
string FilePath = @"D:\Business\" + loopFetchIndApplications.Attributes["new_businessapplicationid"].ToString();
// Create a sub directory
if (!Directory.Exists(FilePath))
{
Directory.CreateDirectory(FilePath);
}
string getAttachments = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='annotation'>
<attribute name='subject' />
<attribute name='notetext' />
<attribute name='filename' />
<attribute name='documentbody' />
<attribute name='mimetype' />
<attribute name='annotationid' />
<order attribute='subject' descending='false' />
</entity>
</fetch>";
getAttachments = getAttachments.Replace("{replaceID}", loopfetchgetIndDocuments.Id.ToString());
EntityCollection fetchAnnotations = service.RetrieveMultiple(new FetchExpression(getAttachments));
foreach (var loopfetchAnnotations in fetchAnnotations.Entities)
{
if (loopfetchAnnotations.Attributes.Contains("documentbody"))
{
//Also check here, if file with the same name already exists, if not create one
if (!String.IsNullOrWhiteSpace(loopfetchAnnotations.Attributes["documentbody"].ToString()) && !File.Exists(FilePath + "\\" + loopfetchAnnotations.Attributes["filename"].ToString()))
{
byte[] data = Convert.FromBase64String(loopfetchAnnotations.Attributes["documentbody"].ToString());
File.WriteAllBytes(FilePath + "\\" + loopfetchAnnotations.Attributes["filename"].ToString(), data);
}
}
}
}
Friday, October 16, 2020
Salesforce OAuth Connection without Username and Password using JWT and C#
keytool
-importkeystore -srckeystore LocalfolderPath\FileName.jks -destkeystore LocalfolderPath\FileName.cer -srcstoretype JKS -deststoretype
PKCS12 -deststorepass password
keytool
-importkeystore -srckeystore LocalfolderPath\FileName.jks -destkeystore LocalfolderPath\FileName.p12 -srcstoretype JKS
-deststoretype PKCS12 -srcstorepass password -deststorepass gridserve
-srcalias Randomname2020 -destalias 1 -srckeypass password-destkeypass password–noprompt
Tuesday, September 29, 2020
MSCRM+ on premise plugin error + could not find default endpoint element that references contract
Hi All,
If you get error with could not find default endpoint element that references contract
while trying in Plugins or Workflow Activity
Please use below code in your code
BasicHttpBinding myBinding = new BasicHttpBinding();
myBinding.Name = "BasicHttpBinding_Service";
myBinding.Security.Mode = BasicHttpSecurityMode.None;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
// Endpoint Address defining the asmx Service to be called.
EndpointAddress endPointAddress = new EndpointAddress(@"http://yourwebservice.com/sms_ws/Service.asmx");
// Call to the Web Service using the Binding and End Point Address.
SendSMS.ServiceSoapClient myClient = new SendSMS.ServiceSoapClient(myBinding, endPointAddress);
Monday, September 21, 2020
HttpClient + GUID Create Record Mscrm C#
HttpClient httpClient = GetHttp().Result;
//var appSettings = ConfigurationManager.AppSettings;
String apiUrl = "https://ORG.crm4.dynamics.com/api/data/v9.1/";
JObject idea = new JObject();
idea.Add("admin_BusinessPoint@odata.bind","/systemusers("+ getUserGuid.Result.ToString().Replace("}","").Replace("{","") + ")");
PASS CRM FIELD INSTED LOGICAL NAME
response.Content.ReadAsStringAsync().Result - retrieve values
Convert
var retrievedcontact1 = response.Content.ReadAsStringAsync().Result;
dynamic data = JObject.Parse(retrievedcontact1);
RootObject objects = JsonConvert.DeserializeObject<RootObject>(response.Content.ReadAsStringAsync().Result);
public class Value
{
[JsonProperty("@odata.etag")]
public string etag { get; set; }
public string systemuserid { get; set; }
public string ownerid { get; set; }
}
public class RootObject
{
[JsonProperty("@odata.context")]
public string context { get; set; }
public List<Value> value { get; set; }
}
Thursday, September 10, 2020
Trigger Workflow MSCRM c#
var executeWorkflowRequest = new ExecuteWorkflowRequest()
{
WorkflowId = Guid.Parse(""), // Guid of workflow
EntityId = Guid.Parse("") // Guid of record
};
var executeWorkflowResponse =(ExecuteWorkflowResponse)orgService.Execute(executeWorkflowRequest);
Day 11 - Customizing Option Sets Dropdown Fields with JavaScript
In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...
-
Introduction: In this blog, we will see how to check length of List Rows in Microsoft flow. Implementation Steps: 1. Navigate to https://f...
-
Hi All, If any one facing the issue in Console application while connecting to MSCRM(onpremises) with IFD as Unable to Login to Dynamics ...
-
Dear All, Today we got requirement to filter N:N Subgrid in D365 --> Quote Entity - Country Field --> Accessorial Entity - Coun...