Posts

Generating Test Files of A Specific Size

While attempting to unit test the max upload size of files to CRM I needed to generates files of different sizes.  Since Windows XP came out Microsoft has included a utility called fsutil that you can run at the command line to do just this thing.

fsutil file createnew filename filesizeinbytes

1. Open a Command Prompt (As Administrator) 2. Run the following command fsutil file createnew "c:\temp\test5.txt" 5242880
If you need to convert from Megabytes to Bytes you can use this quick converter: Megabytes to Bytes Converter

Cannot Access SharePoint Files Without Visitor Access in Dynamics CRM Documents Grid

Recently while building a system which synchronized Dynamics permissions to SharePoint we came upon an error which caused the SharePoint Document grid to tell us that we did not have the correct permissions to access the files.  Our code was creating SharePoint document libraries with their inheritance broken, and then synchronizing the security.  When we viewed the document libraries in SharePoint it appears the users had all the permissions they needed but upon opening the Documents grid in Dynamics CRM we would receive an error.  What we found was that the users needed to have at least read access to the root SharePoint site.  After adding the users into the site Visitors group the grid starting showing users the files they had access to.

SharePoint Documents Grid Error in Dynamics CRM

After setting up Server based authentication between SharePoint and Dynamics on several instances we were having issues on certain instances where users would attempt to access the Document grid within CRM and would receive the following error "You don't have permissions to view files in this location. Contact your Microsoft OneDrive owner or SharePoint administrator for access."  The grid ribbon buttons still loaded and if we clicked on the Open Location button SharePoint would open with all the files displaying which told us that the user had the required permissions.

After troubleshooting with a Microsoft tech for a few hours we concluded that the fix was populating the SharePoint Email Address field on the User record for each user within CRM.  Another important thing to note here is that we were using Azure AD account which had an account name of rick@ad.test.com but the email address was rick@test.com (no ad in the domain name).  I had previously found the articles…

Dynamics Multi Entity Search (Global Search) Entity Selection Using C#

Image
While coming up with deployment scripts i was tasked to ensure that the Dynamics Global Search had specific entities selected.  By utilizing one the undocumented SDK message i was able to set this data. (list of undocumented messages)

The manual way of updating these settings
1. Navigate to Settings -> Administration -> System Settings
2. Click on the button for Select entities for categories search
3. Add/Remove the entities you want utilizing the selection screen.

How to do it utilizing code:


var request = new OrganizationRequest("SaveEntityGroupConfiguration"); //create a new QuickFindCofigurationCollection var qfCollection = new QuickFindConfigurationCollection(); //add the entities you want to include in Global Search qfCollection.Add(new QuickFindConfiguration("contact")); qfCollection.Add(new QuickFindConfiguration("incident")); //set the parameters for the request. It took several hours and digging through the //CRM Sdk dlls to find the …

Filter Customer Id field on Case Entity To Only Show Contacts or Accounts

Recently while working on a project where the customer was utilizing the Case entity they wanted to only allow users to enter contacts into the Customer Id field. In order to achieve this you first need ensure that the pre-search only shows contacts.  Next we need to ensure that if the user clicks the "Look up more records" link they only see the option for Contacts in the Look For drop down.

Note: In order to change this to only show Accounts just change all the references to "contact" or "contactid" to "account" and "accountid" respectively.

//attach our filtering code to the customerid field Xrm.Page.getControl("customerid").addPreSearch(filterCustomerField); function filterCustomerField() { //This filter ensures that no accounts will be returned since the accountid field is never null var customerContactFilter = ""; Xrm.Page.getControl("customerid").addCustomFilter(customerContactFilter, "accoun…

Exporting Duplicate Detection Rules Using CRM Configuration Migration (Data Migration Tool)

Image
In order to move Duplicate Detection Rules to another system utilizing the CRM Configuration Migration tool make sure to add the Duplicate Detection Rule and Duplicate Rule Condition entities to the Schema.

VERY IMPORTANT NOTE!: Before you try to export the records you have to Unpublish the rules otherwise the tool will skip exporting all the Duplicate Detection Rules and just export the Duplicate Rule Conditions causing you import to fail.

Modify Logon Setting in IE When Group Policy Doesn't Allow It

Image
Recently I needed to "Prompt for user name and password" when logging into my Local Intranet zone so that I could test as multiple users.  A colleague of mine made me aware of the registry settings for these option so you can modify.  These settings will be overwritten next time Group Policy is applied but they provide a good temporary workaround.

The specific key for the Local Intranet Zone is located at HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1. The key name is 1A00


Just update this value to 20000 and your setting will now be switched to "Prompt for user name and password"





Here is the listing of the other Zones:

Value Setting ------------------------------ 0 My Computer 1 Local Intranet Zone 2 Trusted sites Zone 3 Internet Zone 4 Restricted Sites Zone

Here is the listing of all the Logon settings you can use:
Value Setting ----------------------------…