Showing posts with label CRM. Show all posts
Showing posts with label CRM. Show all posts

Tuesday 18 July 2017

Render SSRS report using code


 
 
 
using System;
using System.IO;
using System.Web.Services.Protocols;
using myNamespace.MyReferenceName;

class Sample
{
    static void Main(string[] args)
    {
        ReportExecutionService rs = new ReportExecutionService();
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
        rs.Url = "http://myserver/reportserver/ReportExecution2005.asmx";

        // Render arguments
        byte[] result = null;
        string reportPath = "/AdventureWorks Sample Reports/Employee Sales Summary";
        string format = "MHTML";
        string historyID = null;
        string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

        // Prepare report parameter.
        ParameterValue[] parameters = new ParameterValue[3];
        parameters[0] = new ParameterValue();
        parameters[0].Name = "EmpID";
        parameters[0].Value = "288";
        parameters[1] = new ParameterValue();
        parameters[1].Name = "ReportMonth";
        parameters[1].Value = "6"; // June
        parameters[2] = new ParameterValue();
        parameters[2].Name = "ReportYear";
        parameters[2].Value = "2004";

        DataSourceCredentials[] credentials = null;
        string showHideToggle = null;
        string encoding;
        string mimeType;
        string extension;
        Warning[] warnings = null;
        ParameterValue[] reportHistoryParameters = null;
        string[] streamIDs = null;
        
        ExecutionInfo execInfo = new ExecutionInfo();
        ExecutionHeader execHeader = new ExecutionHeader();

        rs.ExecutionHeaderValue = execHeader;

        execInfo = rs.LoadReport(reportPath, historyID);

        rs.SetExecutionParameters(parameters, "en-us"); 
        String SessionId = rs.ExecutionHeaderValue.ExecutionID;

        Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID);


        try
        {
            result = rs.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);

            execInfo = rs.GetExecutionInfo();

            Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime);


        }
        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.OuterXml);
        }
        // Write the contents of the report to an MHTML file.
        try
        {
            FileStream stream = File.Create("report.mht", result.Length);
            Console.WriteLine("File created.");
            stream.Write(result, 0, result.Length);
            Console.WriteLine("Result written to the file.");
            stream.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }

    }
}
 
 
Reference
CRM Refrence
https://community.dynamics.com/crm/f/117/t/244253
https://www.codeproject.com/Questions/399003/Could-not-load-file-or-assembly-Microsoft-ReportVi
http://www.aspnetify.com/2014/07/could-not-load-file-or-assembly.html
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9773e68b-6d06-4bf5-8083-50809536c8e7/the-request-failed-with-http-status-401-unauthorized?forum=sqlreportingservices&forum=sqlreportingservices
https://lakshmanindian.wordpress.com/2012/11/01/attachments-in-microsoft-dynamics-crm-2011/


 

Friday 3 March 2017

Disable the systems reports in CRM

There are two ways, first through the solution, hide it by removing the display options:
Remove all the display in area
And do not to save and publish (for report I think it's optional, but can do it also)
Then, other way, you can change the Visibility by changing the Ownership type from organization to individual.
But, you cannot do it through solution, instead, go to the Sales -> Reports
Then click Edit, change the Viewable..
Once you change the viewable, only the individual owner can see this report, unless the owner share it out.

https://community.dynamics.com/crm/f/117/t/149132
 

Tuesday 20 September 2016

Adxstudio Portals Retail Portal - Import error: Create: adx_review:



Installation Progress

Adxstudio Portals Retail Portal  Import error: Create: adx_review: e4670f15-809d-e211-be82-00261883c555

There was an error during import.
Unexpected exception from plug-in (Execute): Adxstudio.Xrm.Plugins.Products.ProductReviewsAggregationPlugin: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.



Faced this error during ADX retail portal deployment on on-premise CRM instance. This is a known issue in CRM 2016 that is related to installing everything on one box. The update rollup that is in preview will fix this, otherwise you can try to change your required assembly mode from sandbox to none.You can also see what isolation mode of a plugin if you open the Plugin Registration Tool.
  1. open the Plugin Registration tool
  2. connect to CRM instance
  3. Right click on an Assembly and choose update
  4. Now see the Isolation mode

Adxstudio Portals Retail Portal - Import error: Create: adx_review:


Installation Progress

Adxstudio Portals Retail Portal  Import error: Create: adx_review: e4670f15-809d-e211-be82-00261883c555

There was an error during import.
Unexpected exception from plug-in (Execute): Adxstudio.Xrm.Plugins.Products.ProductReviewsAggregationPlugin: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.



Faced this error during ADX retail portal deployment on on-premise CRM instance. This is a known issue in CRM 2016 that is related to installing everything on one box. The update rollup that is in preview will fix this, otherwise you can try to change your required assembly mode from sandbox to none.You can also see what isolation mode of a plugin if you open the Plugin Registration Tool.
  1. open the Plugin Registration tool
  2. connect to CRM instance
  3. Right click on an Assembly and choose update
  4. Now see the Isolation mode

Azure AzCopy Command in Action

Azure AzCopy Command  in Action -  Install - Module - Name Az - Scope CurrentUser - Repository PSGallery - Force # This simple PowerShell ...