Quantcast
Channel: Sam's Activities
Viewing all articles
Browse latest Browse all 3363

How to output file in custom workflow.

$
0
0

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.

Activity ID: 84f47315-d8b3-4618-ae8a-993309b632d7

Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>