Pre-generated XmlSerializers for CrmService


Hi,

While looking for a way to boost performance while using CrmService, these are the two good articles that i found.

http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx

http://uwekaessner.spaces.live.com/blog/cns!21916E8556D908E!175.entry?sa=202741036

Bye..

Nice events and recordings for XRM


Hi,

Have a look at these recorded events.

http://www.xrmvirtual.com/events

Bye..

Plug-in for SetState and SetStateDynamicEntity messages.


Hi, If we want to write a plugin that would run in case of state change of an entity record, we need to attach that plugin to both setstate and setstatedynamicentity messages.

Here is a sample plugin that would prevent an inactive contact record from getting activated.

Plugin has been registered against contact entity and two steps have been registered one on setstate and other on setstatedynamicentity messages on Pre event.

public void Execute(IPluginExecutionContext context)
{
// In case of SetState and SetStateDynamicEntity message InputParameter
// would contain EntityMoniker parameter 
Moniker entity = null;
if (context.InputParameters.Properties.Contains("EntityMoniker") &&
context.InputParameters.Properties["EntityMoniker"] is Moniker)
{
entity = (Moniker)context.InputParameters.Properties["EntityMoniker"];
// Get the state to which record is to be changed
// If Active the record is being activated 
// If Inactive the record is being deactivated
string  state=
(string)context.InputParameters.Properties[ParameterName.State];
// Verify that the entity represents an account.
if (entity.Name == EntityName.contact.ToString() && state=="Active")
{
    throw new InvalidPluginExecutionException("Record can't be activated");
}
}
}
Bye..

Calling a custom web service which uses CrmService from within a plug-in.


Suppose we have a simple web service which uses CrmService to create contact records. Now we want to call this custom web service from within our plug-in.

On doing so, we might receive following errors

System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

or

Microsoft.Crm.CrmException: No Microsoft Dynamics CRM user exists with the specified domain name and user ID

It could be because the credentials of the user are not getting passed from the plugin to the custom webservice.

Here we could the following

We can enable anonymous access and specify a valid CRM user’s credential there.

access

Bye..

 

Web.config settings for Custom Web Application in CRM 4


These are few of the configuration settings we need to consider while deploying our custom web application within ISV folder of CRM.

If we want the page to run under the context of the logged in user than we need to enable impersonation.

    <authentication mode="Windows"/>
    <identity impersonate="true"/>

 

If we are using view state or session state we need to enable them as well.

  <pages enableSessionState="true" enableViewState="true" >

 

CRM 4 implements http modules for multi-tenancy support. Here we need to remove these modules from being called for our custom web application.

<httpModules>
      <remove name ="CrmAuthentication"/>
      <remove name ="MapOrg"/>
</httpModules>
 
Bye..
 
 
 

Active Directory and .NET


The two best links for someone working with Active Directory using .NET

http://www.codeproject.com/KB/system/everythingInAD.aspx

http://www.ianatkinson.net/computing/adcsharp.htm

Bye..

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓