HTTP Error 404.15 – Not FoundThe request filtering module is configured to deny a request where the query string is too long. Exception type: CrmSecurityException Exception message: Could not find GUID for : server$ with SearchFilter: samAccountName


Recently got the above error while trying to open the CRM web application. It was because the password for the account which was being used to run CRM services and CRM App Pool was recently changed.

Have a look at this article as well.


Newly Created Entity not appearing in Stunnware’s Tool (Fetch XML Wizard)


I created two new entities in my CRM 2011 development server and thought of writing a fetch xml query using the Fetch XML Wizard tool of Stunnware.

But much to my surprise while trying to add Entities for the query, I was not able to find them in the list. This happens because of the Metadata Cache not getting refreshed. The tool maintains the cache of the metadata. This post helped me in resolving the issue.


Get the total members count of a Dynamic Marketing List in CRM 2011.


For a Static Marketing List, we can get the total member count from the attribute “Members Count”.

However this attribute doesn’t’ work for Dynamic Marketing List as this value can only be derived at run time, when the query associated with the list is executed.

One way we can get the total count for the list is by following the below steps.

  • We can get the fetch xml query associated with the Dynamic Marketing List.
  • Remove the attribute and order tag from it.
  • Modify it  to include aggregate function.

Sample Code in C#

 private void btnGetMembersDynamicML_Click(object sender, EventArgs e)
 IOrganizationService orgService = GetOrganizationService();

ColumnSet cols= new ColumnSet(new string[] { "query" });

// GUID of the Dynamic Marketing List
 var entity = orgService.Retrieve("list", new Guid("03C4E473-F7DA-E111-B988-00155D886334"), cols);
 var dynamicQuery = entity.Attributes["query"].ToString();

var countQuery = ModifyFetchXML(dynamicQuery);

var memberCountResult = orgService.RetrieveMultiple(new FetchExpression(countQuery));

DataCollection<Entity> dataCollection = memberCountResult.Entities;

int totalMembers = default(int);
 if(dataCollection != null && dataCollection.Count > 0)
 foreach(Entity entityVal in dataCollection)
 AliasedValue value = (entityVal.Attributes["member_count"] as AliasedValue);
 totalMembers = (int)value.Value;

MessageBox.Show("Total Members : " + totalMembers.ToString());


private static string ModifyFetchXML(string dynamicQuery)
 var doc = new XmlDocument();

var entitynode = doc.GetElementsByTagName("entity")[0];

int childCount = entitynode.ChildNodes.Count;

// Remove all the attribute and order tag
 for (int i = 0; i <= childCount; i++)
 var attributenode = entitynode.SelectSingleNode("//attribute");
 if (attributenode != null) entitynode.RemoveChild(attributenode);
 var ordernode = entitynode.SelectSingleNode("//order");
 if (ordernode != null) entitynode.RemoveChild(ordernode);

// add a new attribute tag
 // <attribute name="fullname" alias="member_count" aggregate="count" />
 XmlElement xmlNodeCustomSettings = doc.CreateElement("attribute");

xmlNodeCustomSettings.SetAttribute("name", "contactid");
 xmlNodeCustomSettings.SetAttribute("alias", "member_count");
 xmlNodeCustomSettings.SetAttribute("aggregate", "count");


// Add aggregate= true attribute
 // <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
 var root = doc.DocumentElement;
 if (root != null) root.SetAttribute("aggregate", "true");

return doc.InnerXml;

public IOrganizationService GetOrganizationService()
 Uri organizationUri = new Uri("http://servername/orgname/XRMServices/2011/Organization.svc");
 Uri homeRealmUri = null;
 ClientCredentials credentials = new ClientCredentials();
 credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
 OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
 IOrganizationService _service = (IOrganizationService)orgProxy;
 return _service;

Hope it helps.

“System.ArgumentException: The specified string is not in the form required for a subject” error while sending mail through plugin in CRM 2011.


We were getting the above error in one of our plugin which was using SendEmailRequest to send mail.

As it turned out it was because of the subject not being in proper format in the template



Hope it helps.

Hierarchical report in SSRS to show users and their managers (CRM)


Just created a simple SSRS report that shows the Hierarchy of the users and their manager.

This is how the report looks like

The DataSet query used

Select the row, right click and select group properties option

Select Grouping based on systemuserid

Toggle the visibility based on FullName

Select parentsystemuserid as Recursive Parent from the Advanced option

Set the Left Padding property for the fullname TextBox.

Set the expression for level as Level()

The posts from which I learned creating the hierarchical reports


DateTime Parameter Issue in SSRS (The date/time format is not valid)


In one of our SSRS Report we had 2 Report Parameters, one for “From Date” and other for “To Date”.

On selecting values for them through calendar control, the value was being displayed in the proper format (mm/dd/yyyy). However the value being passed to the query was in the format (dd-mm-yyyy), because of which we were getting “The date/time format is not valid” error.

The following was the regional setting in the server.

We changed it to English (United States)

We tried running the report, but we again got the same issue.

Next we tried by changing the Language Settings of Internet Explorer.

This also didn’t solve the issue.

Finally thought of restarting the server, in case if the settings might not have got reflected properly.

After restarting the system, again tried running the report and it ran successfully J

Hope it helps.