Generate report by code C# on Dynamics 365 - reporting-services

I am using Dynamics CRM 365 online V9. For order, On approval, I want the system to generate a PDF of an order report, attach the PDF and email it to the Customer.
Do you know how If there is a way to generate the report by code C# on a plugin?

Update: The below only works with on-premise CRM
You can generate the report using the ReportService2010 class:
https://learn.microsoft.com/en-us/dotnet/api/reportservice2010.reportingservice2010?view=sqlserver-2016
Then create a new email record and an ActivityMimeAttachment to attach the report to your email. Finally use a SendEmailRequest to send the email.
var result = reportExecutionService.Render(...)
var attachment = new ActivityMimeAttachment
{
Body = Convert.ToBase64String(result),
...
};

Related

Integration between MS Outlook and MySQL

is there any way to connect/Integrate MS Outlook folders to MYSQL single table including Outlook inbox, sent items and if any other folders created by users.
Single Table Format:
|Id|Folder Path|Subject|DisplayTo|DisplayCc|DateTimeSent|DateTimeReceived|IsRead|HasAttachments|Preview|
Below are requirements:
Configure MS Outlook with MySQL
New incoming mail comes to inbox it should get triggered to MySQL table with above format
whenever outgoing mail goes to it should get triggered to MySQL table with above format
connection should check every 60 seconds/ possible intervals
These are tools involved with this project MS Access as front end application, MYSQL as Database and MS outlook as data source.
Thanks in advance!!
It seems you need to develop an add-in for Outlook to have a corresponding MySQL db filled with Outlook data. See Walkthrough: Create your first VSTO Add-in for Outlook for more information.
There are two core events you need to handle to cover incoming and outgoing emails:
The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item.
The ItemSend event is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Send button) or when the Send method for an Outlook item, such as MailItem, is used in a program.
Something like you can create VSTO add-ins using visual studio and code will be something like below
Outlook.Application application;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
application = this.Application;
application.NewMailEx += Application_NewMailEx;
application.ItemSend += Application_ItemSend;
}
private void Application_ItemSend(object Item, ref bool Cancel)
{
if(Item is Outlook.MailItem)
{
//extract all property and save
}
}
private void Application_NewMailEx(string EntryIDCollection)
{
var item= application.Session.GetItemFromID(EntryIDCollection);
if(item is Outlook.MailItem)
{
// extract mailitem property and save to database
}
}
If you want to develop a paid version, you can contact me in Upwork.
https://www.upwork.com/freelancers/~01b266b20bfa60411d
For free help , post comment here :)

Send automatic emails from CSV attachment

Each day I receive an email with a CSV/excel attachment With a list of email addresses. I’d like to automatically take these addresses and mail an email template to all of them. The catch is, it has to be done on a work computer so I can’t download any additional programs to help with it. This will need to be done with native Windows apps. I’ve tried using VBA without success (I’m not well versed). Any help would be appreciated.
You can develop a VBA macro or COM add-in if you are going to distribute the solution to multiple machines. Basically, you need to handle the NewMailEx event of the Application class. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item. The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item.
Private Sub Applicaition_NewMailEx(ByVal EntryIDCollection As String)
Dim mai As Object
Set mai = Application.Session.GetItemFromID(strEntryId)
MsgBox mai.Subject
End Sub
In the event handler, you need to save the attached Excel file to the hard drive. Then you can automate Excel to open the file and read its content for creating a new item based on a template saved. Read more about these actions in the following articles:
How To: Create a new Outlook message based on a template
How To: Create and send an Outlook message programmatically
How To: Fill TO,CC and BCC fields in Outlook programmatically

EWS emails with HTML BodyType

I have an application that periodically polls an 2010 exchange server email inbox for emails with a certain subject.
I am using c#, .Net 3.5 in VS2008. I can successfully connected to, retrieve all the emails I require.
If the Body of the email contains XML which is validated with an xsd, usually this is working fine but when the email has a BodyType of HTML the xml tags are not displayed and it fails the xsd validation.
If I do a show source on the email body the xml tags are all there. My question is, how do I get the actual xml text and not the html text?
I initiate the service using
m_Service = new ExchangeService(ExchangeVersion.Exchange2010);
I am returning the search results using this...
public void getEmails(string searchType)
{
ItemView itemView = new ItemView(int.MaxValue);
SearchFilter searchFilter = new SearchFilter.ContainsSubstring(EmailMessageSchema.Subject, EmailSubject);
SearchResults = Service.FindItems(GetFolderName(searchType), searchFilter, itemView);
}
and loading the individual emails
foreach (Item item in SearchResults)
{
item.Load();
EmailMessage mes = (EmailMessage)item;
string emailBody = item.Body.Text;
}
it is possible to get PR_HTML MAPI property. You can added as extended property in your request. It works with Exchange Web Services .NET, but should also work with EWS Managed API

Is it possible to import pdf form data to an access db

My organization has a bunch of PDF forms filled out and uploaded to a SharePoint site. They would like to run reports on the data in those forms. They also have an access file that syncs with several SharePoint lists they maintain to generate reports.
I'm wondering if there's a way to get the data from the pdf files to their access database without changing their workflow. Which is fill out a pdf form, upload it to sharepoint library, sync access db and run reports. Is there a way to sync this data like a SharePoint list?
I ended up writing Adobe Javascript to send the form data via a SOAP web service to a SharePoint list on save. Once in the SharePoint list I have everything I need to run reports. The Adobe JavaScript looks like below only with ID's and test column data pulled from the pdf form and added to the SOAP XML.
try {
var oAuthenticator ={ UsePlatformAuth: "true"};
var oRequest = {
soapValue: "<UpdateListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> <listName>PDFList</listName> <updates> <Batch OnError='continue' ListVersion='1'> <Method ID='1' Cmd='Update'> <Field Name='ID'>1</Field> <Field Name='testColumn'>ValueChanged</Field> </Method> </Batch> </updates> </UpdateListItems>"};
var cAction = "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems";
var ver = SOAPVersion.version_1_2;
var response = SOAP.request({
cURL:'http://SHAREPOINT_SITE_URL/_vti_bin/Lists.asmx',
oRequest:oRequest,
cAction:cAction,
oAuthenticate:oAuthenticator,
bEncoded:false,
cVersion:ver
});
} catch(e) {
app.alert(e.toString());
}

display reporting services report into asp.net web form

Hello everyone here you see my report in when i run it into my web service URL
but when i run it in an asp.net web form, it display like the second one why please
Here is a sample of my code:
MyReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
MyReportViewer.ServerReport.ReportServerUrl = New Uri("jean-daniel/ReportServer_SQLEXPRESSADDD") ' Report Server URL
MyReportViewer.ServerReport.ReportPath = "/Report Project2/Auction" ' Report Name
MyReportViewer.ShowParameterPrompts = True MyReportViewer.ShowPrintButton = True
MyReportViewer.ShowToolBar = False MyReportViewer.ServerReport.Refresh()
The charts are images and set to store one per session in cache. So if user a and user b access the same chart then it will come back as chart a. - a caching issue. I found a workaround noted below:
Workaround