Leaving Las Vegas – SharePoint Conference 2014 (SPC14) Photos

As the SharePoint community disperses from Las Vegas after another awesome conference it’s time to digest the new information and figure out what that really means for you.

The takeaways for each person are probably different as we all use SharePoint in different ways, although there was one very prominent message being pushed…

Microsoft’s forecast: Very cloudy with a chance of on-prem meatballs

Microsoft was pushing the cloud first model very heavily, Office 365 will be getting all the new bells and whistles with on-prem maybe getting some of the new features down the track. Features that integrate the different services (e.g. Yammer/SharePoint/Exchange/OneDrive) would probably only be available in Office 365 where Microsoft can guarantee the compatible versions across the services and control passing user identity between the services and may never make there way to on-prem.

Attendee’s forecast: We are not ready/can’t move/don’t want to move to the cloud yet

This was the sentiment I was hearing on the booth. The reasons for not wanting to jump to the cloud (at the moment) were varied but most had understandable reasons. Microsoft has the potential to alienate a lot of the community and customers (possibly losing them to competitive products) if they take the big stick approach and try to force people into Office 365.

On a more positive note for on-prem customers, it was announced that there will be a new release of SharePoint (on-prem) in 2015.

The Venetian was an awesome location for the conference. Maybe it’s just me or maybe Vegas has slightly refined itself since the last conference but I thought the area of the strip near the Venetian had a better buzz about it and was just a nicer end of town. The Venetian itself was excellent with plenty of great options for eating and drinking. Anyone know a place that does a gourmet burger better than Vegas?

SPC14 was the conference that saw us announce the growth and re-positioning of our brand. OnePlaceMail has become one product of the larger OnePlaceEnterprise suite. Along with OnePlaceMail, the OnePlaceEnterprise suite contains the new products OnePlaceDocs and OnePlaceLive. This growth and shift was well received at the conference and I’m really looking forward to this new phase as OnePlaceEnterprise enters the market.

Thanks to all those who came up to see us at the conference and traded SharePoint stories. I hope you all enjoyed the conference and were able to walk away more knowledgeable at the end of the day.

Where and why to find me at the SharePoint Conference in Las Vegas (SPC14)

image

Cameron-Dwyer-Microsoft-SharePoint-Conference-2014-Las-Vegas-OnePlaceMail


image

SPC is THE largest SharePoint Conference on earth, nowhere else will you find so many subject matter experts and people willing to talk SharePoint.

I encourage you to be brave and speak to the myriad of Exhibitors and Microsoft people at conference. The Exhibition Hall is a lot quieter outside of the peak lunch/break periods so if you’re in a session that’s not delivering what you hoped, head out and get an expert to yourself.

Why talk to me?
There’s only so many conversations you can squeeze in, my areas of interest include:

  • Overcoming user adoption issues with SharePoint deployments
  • Techniques for making SharePoint quicker and easier to work with from your desktop
  • Extending solutions you build on SharePoint to make them accessible from existing desktop applications without writing code!
  • Anything SharePoint and Mail related
  • SharePoint Site Mailboxes

Where to find me?
I’ll be presenting OnePlaceMail alongside 2 new products (OnePlaceEnterprise and OnePlaceLive) being launched at the conference. I’ll be spending most of the conference at the OnePlaceMail booth #2131 so please come up and say ‘Hi’.

Have a great conference and I hope to see you there.

SharePoint Conference 2014 Las Vegas – Essential Links

sharepoint-conference-2014-las-vegas-cameron-dwyer

These are the essential resources I’ll be keeping my eye on as the SharePoint Conference 2014 in Las Vegas draws nearer.

 

The Official Site Conference Site

Goes without saying, this site IS the official conference site. Announcements, news and details released here are the real deal and your getting the information first hand.

 

SharePoint Conference Party Calendar #SPC14

Joel Oleson is keeping track of SharePints, parties, and events both official and unofficial. Joel’s party guidance in previous years has proven spot on so I hope he comes through with the good again this year!

 

Melalogix Best of Breed Awards and Gala 2014

This looks like it will be one of the largest unofficial parties. There’s limited tickets so keep your eyes and ears open on how to get your hands on a ticket for this one.

 

President Bill Clinton will deliver the keynote address at SharePoint Conference 2014

How often do you get to see an (ex) American President in the flesh? I won’t be missing the keynote, even if I’m more than a little lost of the connection between Bill and SharePoint!

 

The 2014 Microsoft Product Roadmap

My (obvious) tip is that the most significant announcements coming from Microsoft at the conference will be in relation to the 2014 product roadmap. Why wait for the conference? Take a look at this reference to see new updates and release expected soon or around conference time. Some details of what they include is already available. This may influence which sessions you decide to go to…

 

Collabshow Feed on all things SPC14

The Collabshow website has a page dedicated to all things SPC14. The website is run by Joel Oleson and is well worth keeping an eye on for news as the conference gets closer.

 

SPC14 Survival and Readiness Guide

Why start from scratch and try to think of everything yourself? People have already started putting together checklists and info packs on how to get the most out of the conference (even old guides from SPC12 are still quite relevant). This is one of the better one to emerge.

Harness SharePoint Library and Folder Default Views to build more appealing solutions

Article Index

1. Introduction

Why use different default views based on navigation hierarchy?

What are the different levels that a default view can be set?

Caution: Per-location view defaults

2. Library default views

3. Folder default views

4. Custom Folder default views

5. Document Set (and Custom Document Set) default views

1. Introduction

This article describes the different methods and techniques available for configuring default views at different hierarchy levels (folder levels) within a SharePoint library. This article presents the options and how to implement them in SharePoint 2013. All options/settings discussed also apply to SharePoint 2010.

Why use different default views based on navigation hierarchy?

People use libraries for many different purposes. If you are storing different types of documents in a library (especially if you are using different content types) the properties (or columns) of information may be specific to the different types of items in your library. Allowing the default view to be set at different levels in the navigation hierarchy means that you can show the user views that are specifically customized for showing the data in that location.

This is really where all the action is at. We’re talking about what happens when the user navigates either from the root level of a library into a folder, or from a folder into a lower level folder. Usually we group items in folders for some logical reason, and based on that logic it is reasonable to expect that we might want to show a different view of the items in that folder.

We actually have a few options available to us at this level depending on the types of folders that have been implemented. Let me bore you with some details about folders that may assist with some of the terminology used through the rest of this article.

Folders are a content type in SharePoint. Through the SharePoint UI you can create your own custom content types that are based on the folder content type (I’ll refer to these as custom folder content types, or just Custom Folders). Then there’s Document Sets which are based on the folder content type (just like a custom folder content type) but contain a lot of extra intelligence that SharePoint gives you out of the box. In the same way you can create custom folders by extending the base Folder content type, you can also create your own Custom Document Set content types by extending the standard Document Set content type.

The techniques for applying a default view to a folder is different for Folders, Custom Folders, and Document Sets, so we will discuss them one at a time.

What are the different levels that a default view can be set?

Library (top level)

Folder

Custom Folder

Document Set

Custom Document Set

This article will go through each of these different navigation hierarchy levels and explain with examples how default views can be applied and what it looks like.

Caution: Per-location view defaults

SharePoint also has the concept of “per-location view defaults” which is part of the Metadata Navigation and Filtering feature. On the surface it seems that there is a big overlap between setting default at the different hierarchy levels (as I will discuss in this article) and the per-location view defaults (which claim to let you specify a default view to use at any level in the hierarchy). In reality the per-location defaults do not affect the default views used as a user navigates between folders. These per-location view default only apply if you select to open the location via the Metadata Navigation tree. This method has some fairly major caveats and I’d advise caution when using it to implement folder level view defaults. If you want to know more about this option please read SharePoint per-location view settings (capabilities, limitations & pitfalls)

2. Library default views

This one is as simple as it gets. Every list or library in SharePoint contains one or more views. One of those views can be set as the default. You do this directly on the view settings page.

Open the library and select Library Settings

image

Scroll down to the Views section, where you can see all views for the library and also which view is currently set as the default.

image

To change the default view, click the name of the view you want set as the new default. This will open the view settings page. Now tick the ‘Make this the default view’ checkbox.

image

Save the changes and now navigate to the library in SharePoint and this time your selected view is displayed by default.

image

3. Folder default views

When to use it

Use this method when you want to show one view in the root of the library (when not in any folder), and a different view when inside any folder within the library.

What it looks like

In this example I’ve added 3 columns to a standard Document Library (Project, Project Manager, Document Type)

image

In my library I have only folders at the root level of my library (no documents stored at this level) so I just want columns for the title of the folder.

image

When I go into any of the folders I want to see a different default view which shows me documents grouped by Project and also shows the Project Manager and Document Type.

image

How to implement it

Ensure content type management is enabled for the library. This is under Library Settings | Advanced Settings.

image

Create a view to use at the root (top-level) of the library, selecting the desired columns, sort order, etc. I’ve called mine ‘Library View’. The important steps here are to:

1 – Set this view as the default view

image

2 – Expand the Folders setting option and select ‘Show in this view: In the top-level folder’. Note: these options only become available once you have enabled management of content types in the library.

image

Now save the view and the library view settings should look similar to this:

image

Notice that Library View is designated to only show in Top-level and is set as the default view for the library.

Now create another view that you want to use to display documents when inside folders. Again create the view and setup the desired column, grouping, sort order etc. I’ve called mine ‘By Project’. Important steps here are:

1 – Set this view as the default view. Yes I agree this doesn’t seem right. You would expect this to replace the ‘Library View’ as the default view – but in combination with the ‘Folders: Show in’ option some unexpected magic happens! Read on.

image

2 – Expand the Folders setting option and select ‘Show in this view: In folders of content type [Folder]’

image

Now save the view and take a look at the view settings for the library.

image

SharePoint has allowed us to have 2 default views! The show in column tells us that the ‘Library View’ view is the default for the Top-level (or root) of the library and the ‘By Project’ view is the default when in any Folder.

That’s it – when you now navigate to the library you will see the ‘Library View’ and then clicking to navigate inside a folder will automatically switch to the ‘By Project View’.

I was interested to see what would happen if I created another view at the “Show in folder” level and tried to set it as the default. I created a view called ‘By Manager’ and set it as default.

image

As you can see SharePoint is enforcing that I can only have 1 default view at the folder level and this is independent of the default view at the Top-level.

4. Custom Folder default views

When to use it

Use this method when you want to be able to specify a default view at the root level of the library, and a different default view for each type of custom folder. Your intended design might not use custom folders, but consider using them so that you can use the different custom folder types to assign different default views.

What it looks like

I have created a library to hold employee timesheets and expense claims. Timesheets and Expenses are two separate content types that I have created. I want to create a folder per project in the library, and within each project I’ll create an Expenses folder and a Timesheet folder to store the actual documents. Since Expenses and Timesheets contain different columns I want a specific default view when browsing inside Expense folders and a different default view when browsing in Timesheet folders.

image

With the use of custom folder content types I can have a default view at the library level showing detailed folder information (as shown below)

image

Then the default view is changed when browsing into any of the Timesheet folders to present Timesheet specific information (such as Week Start Date, Employee Name and Total Hours) in a nice friendly format.

image

A different default view is used when browsing into any of the Expense folders so you can quickly see Expense specific information such as the Total Amount of the expense.

image

How to implement it

Ensure content type management is enabled for the library. This is under Library Settings | Advanced Settings.

image

Before configuring the library we need to create some custom folder content types that we will use in the library. Management of content types is done at the site level (Site settings | Site Content types)

image

Create a new content type for the custom Timesheet Folder, setting the parent content type to ‘Folder’.

image

Save the new content type, then add the existing Comments site column to this content type

image

Select the Comments column so that our content type now has these columns

image

Create a second custom folder content type for the Expenses Folder, setting the parent content type to ‘Folder’.

image

As with the Timesheets Folder content type, go ahead and add the Comments column

image

Now in the library settings we need to add the two new custom folder content types

image

Select the Timesheet Folder content type and the Expenses Folder content type

image

Your library setting should look similar to this

image

Now we need to create the view we want to use as default when browsing in Timesheet folders

image

Similarly we need a default view to use for showing Expenses

image

To get the default view applying to folders based on the custom content type of the folder, we go into the view settings for the view you want to make a default. So let’s start with the Timesheets by Week view.

Check the ‘Make this the default view’ checkbox

image

Expand the Folders setting option and select ‘Show in this view: In folders of content type: Timesheets Folder’

image

Then edit the Expenses by Project view. Check the ‘Make this the default view’ checkbox

image

Expand the Folders setting option and select ‘Show in this view: In folders of content type: Expenses Folder’

image

After making these changes the Views section of the library settings should be similar to this

image

Notice the All Documents view is set to Show In All. In this state you will find that the All Documents view will be the default (even within Timesheet and Expenses folders). We need to change the All Documents view so that it only used as the default at the top level.

Edit the All Documents view, expand the Folders setting option and select ‘Show in this view: In the top-level folder’. The View settings should now look like this.

image

Enough configuration, let’s start populating the library now. First we will setup the folder structure.

At the top level of the library we create Project folders using the regular Folder content type

image

image

Within each of these project folders, we create one Timesheets folder (using the Timesheet Folder content type) and one Expenses folder (using the Expenses Folder content type)

image

Inside the Project ABC folder, I now have these 2 folders.

image

Browsing to these folders now you should find that the default view is changing automatically as you navigate.

Library root/project subfolders (use All Documents view)

image

Expense Folders (use Expenses by Project view)

image

Timesheet Folders (use Timesheets by Week view)

image

5. Document Set (and Custom Document Set) default views

When to use it

Use this method when you are using Document Sets in your library and you want one view at the root level of the library and a different view when you are viewing the contents of a Document Set. The same default view will be used for all instances of the Document Set within the library. If you have multiple different Custom Document Set content types in the library, you can specify a different default view for each of the different Custom Document Sets.

What it looks like

When browsing the root level (top level) of the library the All Documents view is used by default

image

Navigating into any document set switches the default view so that we can present the document properties in a better way.

image

In the case of multiple Document Set content types you can have a default view at the top-level (customized for showing information about the document sets) then have a different default view for each of the different document set content types. In the following example I have a library with 2 custom document sets (Small Project Document Set and Large Project Document Set).

The default library view shows a list of all document sets (includes both Small Project and Large Projects) and exposes specific document set properties as columns and groups by Project Status

image

When navigating into the first project (which is an instance of the Small Project Document Set) I get a default view customized for small projects

image

When navigating into the second project (which is an instance of the Large Project Document Set) I get a default view customized for large projects

image

How to implement it

Ensure content type management is enabled for the library. This is under Library Settings | Advanced Settings.

image

From Library Settings click Add from existing site content types

SNAGHTML1e60fc2

Add the Document Set content type

image

Once you’ve created your document sets (at least a few to start with), configure the All Documents view to display document set information that you want to see.

Next create a new view to use when showing the content of a document set (I called mine Document Set View)

image

Select Library Settings | Content Types | Document Set

image

Then select Document Set settings

image

Now use the Welcome Page View option to select your new view to show content within Document Sets

image

We are done, navigating into a document set should now use this view by default.

If you are using multiple custom document set content type, simply repeat the steps to assign Welcome Page View to each of the content types.

Further Reading

https://www.nothingbutsharepoint.com/sites/eusp/pages/automatically-switching-views-when-opening-a-sharepoint-folder.aspx

http://office.microsoft.com/en-001/sharepoint-server-help/configure-the-availability-of-views-for-a-location-in-the-site-hierarchy-HA010378684.aspx

http://sharepointpromag.com/sharepoint-administration/implementing-folder-content-types

SharePoint PowerShell How To: Create SharePoint Test Documents in Library Folders for Load/Performance Testing

I often find myself scratching around the local drive of my development machines for remnants of PowerShell scripts to generate libraries in SharePoint with all sorts of different folder hierarchies to test the performance of code I’m working on to ensure it scales well once the folder and document counts start getting up to high numbers and SharePoint thresholds and throttling kicks in.

So rather than keep scratching I’m going to start posting my scripts as I create and use them so I can find/reuse them later on and someone else might find them useful as well. I’m sure they won’t work under all scenarios and situations (and they are not designed to). They are just quick scripts that serve a specific purpose to me at the time and you may be able to tweak to fit your needs.

Create documents in root (or any folder) of a document library

Script description: Takes a file located on c:\ and uploads it to a folder in a document library (renaming it automatically on the way up) to generate 1000 documents in the SharePoint library.

# ---- Script settings ---- 
$sourceDocumentPath = "C:\temp\Test.docx" # Source document to spawn new documents from for the creation
$newFilenamePrefix = "Test document "
$newFilenameExtension = ".docx"
$numberDocsToCreate = 1000

# Settings for the destination to create documents in
$webUrl = "http://vs-server38"
$docLibraryName = "Document Set Performance (6000)"
$folderPathWithinDocLibrary = "/Doc Set Load Test 1001" # Leave empty e.g. "" to create documents in root folder of library otherwise specify path relative to root folder e.g. "/Testing/Folder A"

# -------------------------

#Open web and library
$web = Get-SPWeb $webUrl
$docLibrary = $web.Lists[$docLibraryName]
$docLibraryUrl = $docLibrary.RootFolder.ServerRelativeUrl
$uploadfolder = $web.getfolder($docLibraryUrl + $folderPathWithinDocLibrary)

#Open file
$file = get-item $sourceDocumentPath
$fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()

# Create documents in SharePoint
write-host "Creating $i documents based on the file $sourceDocumentPath"

for($i=1; $i -le $numberDocsToCreate; $i++)
{
$newFilePath = $docLibraryUrl + $folderPathWithinDocLibrary + "/" + $newFilenamePrefix+$i+$newFilenameExtension
write-host "Creating document: $newFilePath ..."
$spFile = $uploadfolder.Files.Add($newFilePath, [System.IO.Stream]$fileStream, $true)
}

write-host "Completed"

#Close file stream
$fileStream.Close()

#Dispose web
$web.Dispose()

Related articles

SharePoint PowerShell How To: Create SharePoint Document Sets for Load/Performance Testing

I often find myself scratching around the local drive of my development machines for remnants of PowerShell scripts to generate libraries in SharePoint with all sorts of different folder hierarchies to test the performance of code I’m working on to ensure it scales well once the folder counts start getting up to high numbers.

So rather than keep scratching I’m going to start posting my scripts as I create and use them so I can find/reuse them later on and someone else might find them useful as well. I’m sure they won’t work under all scenarios and situations (and they are not designed to). They are just quick scripts that serve a specific purpose to me at the time and you may be able to tweak to fit your needs.

Create document sets in the root of a document library

Script description: Create 6000 document sets within the “Document Set Performance Test” library of the “LocationContentTesting” site on the SharePoint Server “vs-server82”.

Note: this assumes you have made have the standard “Document Set” content type available in the library.

#Script settings
$webUrl = "http://vs-server82/locationcontenttesting"
$listName = "Document Set Performance Test"
$numberDocSetsToCreate = 6000
$docSetNamePrefix = "Doc Set Load Test "

### Get web and list
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]

### Get Document Set Content Type from list
$cType = $list.ContentTypes["Document Set"]

### Create new Document Set
[Hashtable]$docsetProperties = @{}

# Create desired number of subfolders
for($i=1; $i -le $numberDocSetsToCreate; $i++)
{
    $newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,"$docSetNamePrefix$i",$cType.Id, $docsetProperties)
    write-host "$docSetNamePrefix$i ... created"
}

$web.Dispose()

Related articles

Detect if New Folders are allowed in SharePoint List/Library using Lists web service from remote application (works across SharePoint 2007, 2010, 2013)

Today I found myself tasked with finding a common method for detecting if a SharePoint list/library had been configured to allow new folders from a remote client application. The method also had to work across all versions of SharePoint (well at least 2007, 2010, 2013 on-premise and in the cloud). This ruled out using client side object model so my investigation turned to web services (yes they are deprecated in SP2013 so be careful using them going forward).

The Lists web service provides a few different ways to return the XML schema of a list(s) (e.g. GetList or GetListCollection)

Here’s a snippet of what the XML looks like that you get back from these web service methods.
05-sharepoint-new-folder-allowed-from-remote-app-list-schema-xml-cameron-dwyer

<List DocTemplateUrl="" DefaultViewUrl="/Lists/announce123/AllItems.aspx" MobileDefaultViewUrl="" ID="{F194025B-A0F2-4318-950A-9197AD8D2285}" Title="announce123" Description="" ImageUrl="/_layouts/15/images/itann.png?rev=23" Name="{F194025B-A0F2-4318-950A-9197AD8D2285}" BaseType="0" FeatureId="00bfea71-d1ce-42de-9c63-a44004ce0104" ServerTemplate="104" Created="20130510 01:18:39" Modified="20131015 03:57:05" LastDeleted="20130802 04:12:40" Version="3" Direction="none" ThumbnailSize="" WebImageWidth="" WebImageHeight="" Flags="603983880" ItemCount="6" AnonymousPermMask="0" RootFolder="" ReadSecurity="1" WriteSecurity="1" Author="9" EventSinkAssembly="" EventSinkClass="" EventSinkData="" EmailAlias="" WebFullUrl="/" WebId="8f69cd67-4cc9-42f4-b104-2fe1e2b7944e" SendToLocation="" ScopeId="fadcba6a-3b00-44b9-a813-db5dc5cf3858" MajorVersionLimit="0" MajorWithMinorVersionsLimit="0" WorkFlowId="" HasUniqueScopes="False" NoThrottleListOperations="False" HasRelatedLists="" Followable="False" AllowDeletion="True" AllowMultiResponses="False" EnableAttachments="True" EnableModeration="False" EnableVersioning="False" HasExternalDataSource="False" Hidden="False" MultipleDataList="False" Ordered="False" ShowUser="True" EnablePeopleSelector="False" EnableResourceSelector="False" EnableMinorVersion="False" RequireCheckout="False" ThrottleListOperations="False" ExcludeFromOfflineClient="False" CanOpenFileAsync="True" EnableFolderCreation="False" IrmEnabled="False" IsApplicationList="False" PreserveEmptyValues="False" StrictTypeCoercion="False" EnforceDataValidation="False" MaxItemsPerThrottledOperation="5000" xmlns="<a href="http://schemas.microsoft.com/sharepoint/soap/&quot;">http://schemas.microsoft.com/sharepoint/soap/"</a> />

After diligently looking through all of the attributes here it doesn’t seem like the “New Folders allowed” option is included. One attribute did catch my eye however… the “Flags” attribute. What was this for and could it hold the secret I was after?

I went into SharePoint toggled the Allow New Folders setting reran my code to call the Lists web service and grabbed the XML again to test if anything changed in the Flags attribute.

On my initial run through the Flags attribute had a value of “603983880″ (no new folders allowed), on my second run through the Flags attribute had indeed changed to “67112968″ (new folders allowed). Great, somehow this Flags attribute holds the key, but how do you make use of this?

My understanding of flags is that they work on an individual bit level, essentially every bit can have an on/off state. So this means a flag can hold the state of many different variables. So time to get binary! It’s been a few years since I last sat in a classroom and figured out binary/decimal conversions with a pencil and paper so let’s just cheat – or actually let’s use a much faster tool for the job.

I started up Windows Calc and put it into Programmer mode.

01-sharepoint-new-folder-allowed-from-remote-app-windows-calc-programmer-cameron-dwyer

Next set the calc to Dec(imal) mode and cut/paste the initial value of the flag in

02-sharepoint-new-folder-allowed-from-remote-app-paste-flag-decimal-cameron-dwyer

Now click on Bin(ary) to convert the number and we get:

100100000000000001000000001000

This on it’s own gives us nothing, but if we repeat the steps with the second value of the flag (after we toggled the allow New Folders setting) we get the binary value:

000100000000000001000000001000

Now we have something to work with, if you align these 2 values under each other you can see that just a single bit has changed.

03-sharepoint-new-folder-allowed-from-remote-app-bitwise-flag-comparison-cameron-dwyer

That’s the bit that represents the “Allow New Folder” setting.

Before we dive into the code for the solution I’ll explain why the values you see in the code don’t look like the binary numbers above. Binary is damn hard to read, very long to type, and prone to typing errors. I’ve converted these binary numbers to Hex in order to do the comparisons. When you convert these 2 numbers to Hex (using calc again) you get

04-sharepoint-new-folder-allowed-from-remote-app-hex-flag-comparison-cameron-dwyer

As you can see, we still have our difference of a single number in the sequence but it’s a lot less digits.

So now all that’s left is the code that checks if this bit has been set or not.

// Detect if folders are allowed in this list/library - it's hidden in the Flags attribute.
UInt64 flags = 0;
bool foldersAllowed = false;
string flagsStr = listNode.Attributes.GetNamedItem("Flags").InnerText;
if (UInt64.TryParse(flagsStr, out flags))
{
    foldersAllowed = ((flags & ((ulong)0x20000000L)) == 0L);
}

SharePoint PowerShell How To: Create SharePoint Library Folders for Load/Performance Testing

I often find myself scratching around the local drive of my development machines for remnants of PowerShell scripts to generate libraries in SharePoint with all sorts of different folder hierarchies to test the performance of code I’m working on to ensure it scales well once the folder counts start getting up to high numbers.

So rather than keep scratching I’m going to start posting my scripts as I create and use them so I can find/reuse them later on and someone else might find them useful as well. I’m sure they won’t work under all scenarios and situations (and they are not designed to). They are just quick scripts that serve a specific purpose to me at the time and you may be able to tweak to fit your needs.

Create folders in the root of a document library

Script description: Create 4000 subfolders within the “Folder Performance Test 01” library on the SharePoint Server “vs-server38”

#Script settings
$webUrl = "http://vs-server38"
$listName = "Folder Performance Test 01"
$numberFoldersToCreate = 4000;
$folderNamePrefix = "folder";

# Open web and library
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]

# Create desired number of subfolders
for($i=1; $i -le $numberFoldersToCreate; $i++)
{
$folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "$folderNamePrefix$i")
$folder.Update()
write-host $i
}

#Dispose web
$web.Dispose()

Create folders within an existing folder in a document library

Script description: Create 4000 subfolders within a folder called “C” within the “Folder Performance Test 02” library on the SharePoint Server “vs-server38”

# Script settings
$webUrl = "http://vs-server38"
$listName = "Folder Performance Test 02"
$subFolderName = "C"
$numberFoldersToCreate = 4000;
$folderNamePrefix = "folder";

# Open web and library
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]

# Get handle on the subfolder
$subFolder = $list.RootFolder.SubFolders.Item($subFolderName);
Write-Host $subFolder

# Create desired number of subfolders
for($i=1; $i -le $numberFoldersToCreate; $i++)
{
$folder = $list.AddItem($subFolder.ServerRelativeUrl, [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "$folderNamePrefix$i")
$folder.Update()
write-host $i
}

#Dispose web
$web.Dispose()

Related articles

How to find the Version, Culture and PublicKeyToken of an Assembly (DLL) using PowerShell

In response to a question on my article How to install a DLL to the GAC on Windows Server 2012 using only PowerShell (without having to install SDK or Visual Studio) here’s how you can find the PublicKeyToken for a DLL using only PowerShell.

([system.reflection.assembly]::loadfile("c:\temp\MyDLL.dll")).FullName

The output of this PowerShell statement will provide the Version, Culture and PublicKeyToken as shown below.
MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=630d986a50055aa6

Follow

Get every new post delivered to your Inbox.

Join 53 other followers

%d bloggers like this: