Thursday, November 8, 2012

Remove Destination Folder from Upload File dialog

After upgrading from 2007 to SharePoint 2010 we noticed that the upload dialog now has a destination folder field to allow to select a destination folder in SharePoint.

The client requested this destination folder to be removed.

I found the following blog to be a great help,

I have included an extract from this blog as I have come across many blogs that reference a solution and the link no longer works or the web page / blog has been removed.

"A Google search on this led me to this very informative and helpful blog by Brian McCullough. It looks like that this behavior is due to the different values that are assigned to the vti_foldersubfolderitemcountproperty in the Folder's property bag for an upgraded object versus a new object.

For upgraded objects, this property’s value is set to 1.
For new objects, this property’s value is set to 0.

Also, the upgrade process sets the SPWeb.CustomUploadPage property for upgraded sites to a custom upload page titled uploadex.aspx, as opposed to upload.aspx which is the default page for file uploads. And this custom upload page contains the “Destination Folder” field.
... Brian provided a PowerShell script in his blog that loops through all Web sites that are contained within the site collection, including the top-level site and its subsites, and checks to see if the SPWeb.CustomUploadPage property is not equal to blank. If true, then it sets the SPWeb.CustomUploadPage property to blank. Doing so, removes the custom upload page (uploadex.aspx) from SPWeb, and reverts back to the default upload page (upload.aspx), which does not contain the “Destination Folder” field. 

Here is the PowerShell script to remove the custom upload page (containing the Destination Folder field):

foreach($webapp in get-spwebapplication)
foreach($site in $webapp.Sites)
foreach($web in $site.AllWebs)
if ($web.CustomUploadPage -ne "")

Out-File C:\Logs\WebsWithDestinationFolder_Log.txt -Append -InputObject $web.Url

$web.CustomUploadPage = ""


No comments:

Post a Comment