Search This Blog
Tuesday, May 28, 2019
Monday, May 27, 2019
Friday, May 24, 2019
Download/Edit existing word template from Dynamics 365
Download/Edit existing word template from Dynamics 365
There is no direct ways to download the existing download template in Dynamics CRM. In order to do that it we can do it from SDK code.
There is no direct ways to download the existing download template in Dynamics CRM. In order to do that it we can do it from SDK code.
Guid templateId = new Guid("3AE567D9-BEB5-E711-8147-E0071B6AE051");
Entity objDocTemplate = objService.Retrieve("documenttemplate", templateId, new ColumnSet(true));
if (objDocTemplate != null && objDocTemplate.Attributes.Contains("content"))
{
var ms = new MemoryStream(Convert.FromBase64String(objDocTemplate["content"].ToString()));
var fs = new FileStream(@"C:\LOAWordTemplate.docx", FileMode.CreateNew);
ms.CopyTo(fs);
fs.Flush();
fs.Close();
}
Tuesday, May 21, 2019
Monday, May 13, 2019
Tuesday, March 5, 2019
In order to access security critical code, this assembly must be fully trusted.Assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is a conditionally APTCA assembly which is not enabled in the current AppDomain. To enable this assembly to be used by partial trust or security transparent code, please add assembly name 'System.Web.Extensions
While using JavaScriptSerializer class (referencing System.Web.Extension dll in the plugin project) the below error thrown at the run time.
In order to access security critical code, this assembly must be fully trusted.
Assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is a conditionally APTCA assembly which is not enabled in the current AppDomain. To enable this assembly to be used by partial trust or security transparent code, please add assembly name 'System.Web.Extensions
Solution:
Instead of Above Code:
In order to access security critical code, this assembly must be fully trusted.
Assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is a conditionally APTCA assembly which is not enabled in the current AppDomain. To enable this assembly to be used by partial trust or security transparent code, please add assembly name 'System.Web.Extensions
Solution:
JavaScriptSerializer jss = new JavaScriptSerializer();
dynamic obj = jss.Deserialize<dynamic>(responsebody);
string token = obj["access_token"];
Instead of Above Code:
public class AccessToken
{
public string access_token { get; set; }
}
using (var memorystream = new MemoryStream())
{
var deserializer = new DataContractJsonSerializer(typeof(AccessToken));
StreamWriter writer = new StreamWriter(memorystream);
writer.Write(responsebody);
writer.Flush();
memorystream.Position = 0;
AccessToken deserializedResult = (AccessToken)deserializer.ReadObject(memorystream);
string token1 = deserializedResult.access_token;
}
Subscribe to:
Posts (Atom)







