I have an custom workflow, This workflow has below codes Like:
InstantiateTemplateRequest itr = new InstantiateTemplateRequest();
itr.ObjectId = customer.Id;
itr.ObjectType = customer.LogicalName;
itr.TemplateId = email.Id;
InstantiateTemplateResponse instTemplateResp = (InstantiateTemplateResponse)service.Execute(itr);
//Serialize the email message to XML, and save to a file.
XmlSerializer serializer = new XmlSerializer(typeof(InstantiateTemplateResponse));
string filename = "email-message.xml";
using (StreamWriter writer = new StreamWriter(filename))
{
serializer.Serialize(writer, instTemplateResp);
}
Now, I create an button in ribbon, When use clicked the button, It will invoke my custom workflow,
expected: workflow output an email-message.xml to user.
actual:
Unexpected exception from plug-in (Execute): {My workflow assembly fullname}: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. If you contact support, please provide the technical details.