My Photo

Microsoft Dynamics 365

Official Blog for Microsoft Dynamics Functional and Technical Solutions....

Get Parameter from URL in C#

Get Query from URL and then get Parameter as required .

      string URLT = "localhost:2081/page.aspx?CaseID=662BB71D-CFF9-E711-90CD-00155DD3F14C";
            Uri uri = new Uri(URLT);
            var query = HttpUtility.ParseQueryString(uri.Query);
            var param1 = query.Get("CaseID");
            Guid CaseGUID = new Guid(param1);

SOURCE : mscrm.com

Error : "Thread was being Aborted" Response.Redirect() and Server.Redirect () not working in code behind C#

Error : "Thread was being Aborted"

InnerException : null

Message : Thread was being aborted"

Source : Unable to evaluate expression because the code is optimised or a native frame is on top of the call

Stack trace :  at System.Threading.Thread.AbortInternal()
   at System.Threading.Thread.Abort(Object stateInfo)
   at **.Response.Page_Load(Object sender, EventArgs e) in C:\Users\**\documents\visual studio 2015\Projects\**\**\Response.aspx.cs:line 87

try {
Response.Redirect(redirectionURl);
 }
catch (Exception ex){
Response.Redirect(redirectionURl);
}

Resolution 

Response.Redirect Method[^] when called with just one parameter would throw ThreadAbortException. You should pass false as the second parameter and then complete the request. Quoting from the link mentioned above:

MSDN HttpResponse.Redirect Method :
When you use this method in a page handler to terminate a request for one page and start a new request for another page, set endResponse to false and then call the CompleteRequest method. If you specify true for the endResponse parameter, this method calls the End method for the original request, which throws a ThreadAbortException exception when it completes. This exception has a detrimental effect on Web application performance, which is why passing false for the endResponse parameter is recommended

try {
Response.Redirect(redirectionURl,false);
 }
catch (Exception ex){
}

Hope it helps !!

Happy Coding 😊

SOURCE : mscrm.com

Get Plugin Registration tool and assemblies from NuGet Packages for Dynamics 365 , v9.0

With the release of Dynamics 365 (online), version 9.0, there are a lot of changes in our developer documentation:
No more monolithic SDK download : Getting the assemblies and tools you need
SDK assemblies and tools will be distributed only via NuGet. We will provide a script that will allow you to download the assemblies and tools from NuGet.

You can follow below steps to download Nuget Packages using Visual studio

Step 1 Right Click on to your visual studio project and click on to manage NuGet Packages


Step 2 Search for "Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool" and click on install


Click on I accept


Step 3 Navigate to the package directory of that project


Step 4 Search the folder Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.X.0.0.X



Done!! now you will be having your latest Plugin registration Tool

Sample PRT Reference for quick start  : Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.9.0.0.7

In the same way you can download any of the NuGet assemblies and tools

Hope it helps !!

Happy CRMing


SOURCE : mscrm.com

Unable to Connect Plugin Registration tool with MS CRM v9 / D365 SDK

On
ISSUES:

Not able to login Plugin registration tool (Keep popping up for Credentials)

Resolution:

1. Update latest SDK from the Download tools from NuGet or Quick start Plugin Registration Tool V9.0.0.7

For downloading the latest PRT from VS Nuget packages - this link might be useful

2. Modify using TSL to 1.2 through Fiddler .

Step 1 Open Fiddler and navigate to Tools - Options - HTTPS Tab


Step 2 Under HTTPS tab click on to Protocols link - a Popup will come change the TLS vesion from 1.0 / 1.1 to tls 1.2.  i.e. " <client>;ssl3;tls1.2 " and press on ok


Now you will be able to connect to your CRM v9 Organisation with PRT

Happy CRMing 😊

SOURCE : mscrm.com

Could not load file or assembly 'Microsoft.Bot.Connector, Version=3.12.2.4, Culture=neutral, PublicKeyToken=##' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Could not load file or assembly 'Microsoft.Bot.Connector, Version=3.12.2.4, Culture=neutral, PublicKeyToken=##' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Error 


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Bot.Connector, Version=3.12.2.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)



Reason

 Microsoft.Bot.Builder library got update to Version=3.12.2.4

Resolution

Update the Microsoft.Bot.Builder library to latest version

Right Click on your Project and Click on manage NuGet Packages


Search for Microsoft.Bot.Connector and click on update  


Then press on accept




Hope It helps

Happy Coding 😊

SOURCE : mscrm.com

Entity for Views in CRM based on View Ownership - SavedQuery and UserQuery Entity

There are 2 types of View in CRM entity based on View Ownership , which are stored in two different entities.

1)  Organisation or System View - stored in the View Entity (SavedQuery)
2)  Individual, personal or User/Team View - stored in the Saved View Entity (UserQuery)

Below is the Fetch XML that you can use to retrieve the Data of the entites

1)  Organisation or System View
<fetch top="5000" >
  <entity name="savedquery" >
    <attribute name="name" alias="ViewName" />
    <attribute name="createdbyname" alias="Owner" />
    <attribute name="description" alias="Description" />
    <attribute name="returnedtypecode" alias="returnCode" />
    <attribute name="fetchxml" alias="fetchXML" />
  </entity>
</fetch>

2)  Individual, personal or User/Team View
<fetch top="5000" >
  <entity name="userquery" >
    <all-attributes/>
    <attribute name="name" />
    <order attribute="name" descending="false" />
    <attribute name="ownerid" />
    <attribute name="modifiedon" />
    <attribute name="userqueryid" />
  </entity>
</fetch>

We can retrieve the data of these entries by C# also you can see the full code example here:
https://msdn.microsoft.com/en-us/library/gg594431.aspx

You can also use LINQ query for retrieving these view.

Happy CRMing 😊