Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Automating Attorney Files and Case Folders Creation in SharePoint
July 13
Automating Attorney Files and Case Folders Creation in SharePoint

In my last masterpiece, Tackling SharePoint's 5000 Item Limit with PowerShell and Search, I show how to use PowerShell with Search to return more than 5000 items from a SharePoint list or library, even if SharePoint refuses to return more than 5000 items. Pretty impressive, right? When demonstrating something like that you need a list or library with more than 5000 items. There are are a lot of scripts out there that can create test data, but I needed something specific. So, I opened up a new windows in VS Code and got to coding.

The PowerShell function I wrote is Add-AttorneyFiles, which is designed to streamline the creation of attorney files and case folders. Lots and lots of them.

This function has a few parameters to tailor the files and folders it creates. It accepts two mandatory parameters, AttorneyCount and CaseCount, specifying the number of attorneys and case folders to create for each attorney.

There are also a few switch parameters that allow you to customize the function's behavior further. You can choose to create a file in each case folder using the CreateStaticFile switch, or specify that only closed or client case folders should be created with the OnlyClosedCases and OnlyClientCases switches.

You can also specify the name of the static file created using the StaticFileName parameter. If no name is provided, the function will default to creating a file named "readme.txt".

The function starts by checking if a connection to a SharePoint site exists. If it does, the function creates attorney files and case folders in a SharePoint directory. The names for these attorney files are generated randomly from a list of common first and last names. This randomness helps to create a more realistic environment for testing.

Once the list of attorney names is created, the function will loop through each attorney, creating the appropriate case folders, either client case folders, closed case folders, or both, based on the parameters passed in.

The function gives the folders and files it creates a randomly generated last and first name, along with a random case number, for a more realistic setup.

If the CreateStaticFile switch is present, a static file will be created in each case folder. The content of these static files is a random selection of words, downloaded from a free online dictionary. This randomization also contributes to a more realistic testing environment.

Here's an example of how you might use this function:

Add-AttorneyFiles -AttorneyCount 10 -CaseCount 5 –CreateStaticFile


This will create 10 attorney folders, each with 5 case folders. A static file named "readme.txt" will be created in each case folder. For my blog a created a whole lot of autorun.inf files.

By automating the setup of this testing environment, I was able to generate a high volume of test data, with a format that accurately represented my client’s data, without exposing any of it.

I’ve uploaded the code to GitHub. Check it out.

Happy PowerShelling, and as always, feel free to drop any questions or comments below!





Fine Posting, We're an important believer around writing commentary for web pages so that you can allow the site freelancers realise that they’ve increased a little something valuable so that you can the ether!
 on 8/20/2023 7:20 AM


Thanks for providing this kind of blog. Keep posting.
 on 8/26/2023 2:32 PM

shell shockers

shell shockers is a cost-free internet-based game that immerses players in an unconventional realm where malevolent eggs are engaged in infiltration. Please choose your weapon and eradicate them from existence.

 on 9/10/2023 10:31 PM


Welcome to Hill House Condo - Your Gateway to Luxurious Living in River Valley! If you're seeking an exclusive, urban retreat, Hill House Condo is your answer. Explore our meticulously designed homes, check out the Hill House Showflat, and discover Hill House Price options here. Hill House Showflat
 on 9/11/2023 8:18 AM


These girls can make the best use of these high-quality dresses, they look very beautiful in them. There are high-quality clothes available for people who work as escorts, you can choose from many options.  These girls can make the best use of these high-quality dresses, they look very beautiful in them. There are high-quality clothes available for people who work as escorts, you can choose from many options.

 on 9/16/2023 2:46 AM


Different styles of clothes available for escort girls There are so many women who have the passion to work as high-profile escorts and these days they are very popular and earn a lot of money by making use of the credibility they earn in their work. 

 on 9/16/2023 2:48 AM


They have a great personality that helps them to do business very well. They are no longer just pretty faces but are also well-known for their quality services. They can escort them anywhere they want to go with their clients. There are many high-profile girls who are available for escort services, you can find them online as well.
 on 9/16/2023 2:48 AM

Re: Automating Attorney Files and Case Folders Creation in SharePoint

Great post. The particular submit has an effect on plenty of important difficulties individuals community. We all can't be uninvolved to be able to these kinds of difficulties. This kind of submit offers guidelines and also principles. Extremely useful and also
 on 9/16/2023 9:31 AM


With thanks for any posting plus superb recommendations.. sometimes I actually as well reckon that diligence is definitely a vey important ingredient of finding being successful. <a href="">contentterminal</a>
 on 9/18/2023 8:19 AM


Cultivate the nice give good results, I just read through a small number of items on that blog not to mention In my opinion that this web site blog page might be proper significant as well as gained circles from awesome advice. <a href=""></a>
 on 9/21/2023 5:45 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.


Body *

Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person


Want a message when I reply to your comment? Put your Twitter handle here.