Posts

Showing posts from April, 2019

Finding Larges Files on Drive Using Powershell

Recently a colleague of mine was having issues with low drive space on one of our servers.  Because this is a clients system i am unable to copy over WinDirStat which is what i would usually use to determine what is eating up all the drive space.  Instead I ended up using PowerShell to show me to top files which were eating up space.

dir -path c:\ -rec -ErrorAction SilentlyContinue | sort -desc Length | select -first 20

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…