Hi,
Anyone has a WFA library that can generate and attach a report to an email?
Possible to use the same method like on-premise?
Thanks!
====================================================
var rsExec = new ReportExecutionService();
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsExec.Url = reportServerAddress;
//Load report
rsExec.LoadReport(reportFolderAndName, historyId);
// pass parameters
rsExec.SetExecutionParameters(new ParameterValue[] { new ParameterValue() { Name = "ApplicationId", Value = ApplicationRecord.Get<EntityReference>(executionContext).Id.ToString() } }, null);
//List of Format XML, NULL, CSV, IMAGE, PDF, HTML4.0, HTML3.2, MHTML, EXCEL, and Word
Byte[] result = rsExec.Render(AttachmentFormat.Get<String>(executionContext), deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);
Entity attachment = new Entity("activitymimeattachment");
attachment["filename"] = AttachmentName.Get<String>(executionContext);
attachment["subject"] = AttachmentSubject.Get<String>(executionContext);
attachment["body"] = Convert.ToBase64String(result);
attachment["mimetype"] = "application/octet-stream";
attachment["objectid"] = new EntityReference("email", EntityType.Get<EntityReference>(executionContext).Id);
attachment["objecttypecode"] = "email";
service.Create(attachment);
*This post is locked for comments