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 = ""


SharePoint incoming email with msg attachment

I have created a document library configured to allow incoming emails in a SharePoint 2007 environment.
All email attachments I have sent in thus far has been added to the document library except for .msg files.

I came across this post which explains why:

The following is an extract from this forum post:
"There is no fix for this. I have raised this issue with Microsoft and they said that it is a product Limitation.
What you can do is write a custom email event handler to strip the attachment from the orginal email.The .msg would come as an eml file."

Tuesday, May 22, 2012

Find Feature name from Feature ID

I received the following error:
The site collection requires feature {791fce91-700e-4219-b432-52d5c10874b2} to be activated.

I found this simple but helpful tool which provides the feature name from the ID to help identify which feature needs to be activated.

Makes the task a little bit easier.

Wednesday, April 25, 2012

The web application at http://xxx.xx.xx.xx could not be found

I was receiving the following error when trying to call a web service externally using the IP address.

The web application at http://xxx.xx.xx.xx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Adding alternate access mappings for web application in Central Administration sorted out the issue.

Friday, April 13, 2012

Error when trying to create new Uri using value from SPListItem[“FileRef”]

I have taken over maintenance of a SharePoint solution recently deployed to SharePoint 2010 (which was previously running on SharePoint 2007).
It has a timer job that runs checks unprocessed items in a library, if it has more than 5 attachments, it proceeds to great a compressed file for these items. Within this procedure it uses the SPListItem[“FileRef”] to create a new Uri. When it does this I get the following error:

Message: Error attaching files: , Invalid URI: The format of the URI could not be determined. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at …

According to the uses this was working before in SharePoint 2007. The reason it fails is because the SPListItem[“FileRef”] returns a relative url.
I have amended this to use the Encoded Abs Url, so that my code now looks like this:

lst.FileURL = item["ows_EncodedAbsUrl"].ToString();

This works.