How To Expose Files in a Shared Folder for Remote Access with SharePoint

I just completed a Proof-of-Concept setup to allow the users to remotely access files that sit on a network share, using SharePoint and IIS 6.

I have a shared folder in \SHARE2007Shared and I wanted it to be accessible from http://share2007 (the SharePoint portal site).

The outline of the setup is like this:

  • Add a new File Share Content Source to SharePoint (MOSS) search settings, pointed at \SHARE2007Shared


  • Run a full crawl and check that it indexes the files correctly, searching for a file. Notice that the URL of the file is pointing at the file share directly.


  • Open the IIS console and add a new virtual directory within the SharePoint portal site, pointing it at \SHARE2007Shared. Give it any name that suits you. (I chose “uncshares”). I use a fixed identity to access the file share, because SharePoint crawler will perform the security checking for the current user and I avoid identity delegation to the file share.


  • Add a new Server Name Mapping in search settings, replacing file://share2007/shared references to http://share2007/uncshares
  • Run a full crawl, again
  • Search for a file from SharePoint portal. You should notice that the displayed URL is pointing to the IIS virtual directory, not to the file share directly.


Community Kit for SharePoint Needs You!

As you might know, I contribute to Community Kit for SharePoint (CKS). It’s a CodePlex-hosted community project aimed to provide the community with SharePoint extensions and starters that are not present in the out-of-the-box edition.

This project has also put me in contact with some excellent SharePoint professionals who are dedicated to the community, such as Paul Ballard, Zac Smith, Brendon Schwartz, Russ Basiura, Stacy Draper and Dee Anne Kotzur, among others.

Right now, there are several “almost finished” editions, such as:

The CKS:Corporate Intranet Edition

There are several editions that haven’t progressed beyond some initial research. One of them is the Corporate Intranet Edition. The features envisioned for this edition are, mainly:

  • A set of professionally designed master pages and CSS themes
  • A set of templates such as “corporate crisis management”, “risk management” or SOX-compliance template
  • Wildcard search
  • Taxonomy and Tagging content
  • Site creation wizard, to help a user to choose between 40+ templates (most of which will come from Application Templates for SharePoint)

The current state of affairs is that since the beginning we haven’t had the momentum that other CKS editions had, and we couldn’t push the edition to something releasable. The main effort was made by Russ Basiura, Dee Anne Kotzur and myself, but the real-life issues and lack of commitment/feedback from the community took its toll.

However, we’re determined to get the project back to the track and push it forward. But, we can’t do it alone. We need your help!

i want you us army

How Can You Help?

First, check the overall CKS project information and ask yourself if you are really into it. Committing to a community project isn’t something to be judged lightly. You will have to spare some time regularly to make the project progress, or to inform the rest of the team how are you doing, due to sporadic nature of the work in a community of developers.

Do you still want to contribute?

Please keep in mind that your contribution doesn’t necessary have to be code development. This project will eventually need testers and documentation writers as much as developers. If you have trusted colleagues or friends who would be good at either of those roles, please recruit them to be part of the project team.

Ok, so you still want to help us or you know somebody that could help us in CKS:CIE project?

Send an e-mail to either Russ Basiura (russ AT or me (ekapic AT, explaining your contribution idea and your short background. We will contact you shortly after that.

I don’t want/have time to commit but I have an idea that should be incorporated into CKS:CIE

Please feel free to comment that at the official CKS:CIE page at CodePlex.

The Final Words

Thank you for your interest in reading this post. The SharePoint community is a powerful thing that we all comprise, and we hope that together we can follow our more successful siblings such as CKS:EBE or CKS:EWE.

Even More SharePoint 2009 Evidence

  • Master Data Management: It seems that Microsoft last year acquisition of Stratature will result in their MDM mechanism being a part of Office 14 servers, as announced on the roadmap.
    What’s Master Data Management? See Wikipedia entry for instance, I imagine it being a “reference” framework for your enterprise data, something like content types but on steroids.
  • Technology Adoption Program (TAP) Nominations are open for Office 14, meaning that selected customers and partners will soon receive the beta.
  • This blog entry affirms that:
    • SharePoint is internally available since February in Microsoft
    • It rocks!

SharePoint 2009 Will Be x64 Only

(In addition to my previous blog entry speculating about the features of the next version of SharePoint)

  • the SharePoint 2009 will be available only in 64 bits mode
  • the number of the next version is more likely to be “SharePoint 2009” (as leaked in Podcasting Kit for SharePoint FAQ, and quickly “corrected” by Microsoft)

As always when discussing future versions, the standard disclaimer: this information is based solely on my experience with SharePoint and public information and it is not even remotely official.

Hiding List View Group Headers

It’s really annoying that SharePoint displays those pesky column names followed by a colon when you group by a column. In this example I use the the columns “Categoria” and “Titulo” to group a bunch of pages.


In addition, the gray header row is ugly, too.

We can hide it with some Content Editor Web Part (CEWP) and JavaScript magic.

The offending elements can be identified:


We have to hide the following elements:

  • a TR element with class name ms-viewheadertr (the header row)
  • the fourth and the fifth child of a TD element with class names ms-gb (the column name of the first group by and a colon)
  • the fourth and the fifth child of a TD element with class names ms-gb2 (the column name of the second group by and a colon)

I use the excellent getElementsByClassName function developed by Robert Nyman in order to get those elements by class name.

This is the code to be pasted in a CEWP at the same page where you have the “ugly” list view. Please note that the text node which contains the colon must be removed instead of being hidden.

<script type="text/javascript" language="javascript">

function HideHeaders()
  var elements = getElementsByClassName(document, "td", "ms-gb");
  var elem;
  for(var i=0;i<elements.length;i++)
     elem = elements[i];
     elem.childNodes[3].style.display = "none";

  elements = getElementsByClassName(document, "td", "ms-gb2");

  for(var i=0;i<elements.length;i++)
     elem = elements[i];
     elem.childNodes[3].style.display = "none";

  elements = getElementsByClassName(document, "tr", "ms-viewheadertr");

  for(var i=0;i<elements.length;i++)
     elem = elements[i]; = "none";

    Written by Jonathan Snook,
    Add-ons by Robert Nyman,
function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/-/g, "\-");
    var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];
    return (arrReturnElements)

This is the result of this code:


Much better, isn’t it?

A Marvelous Little Utility for Zooming

Tired of changing the font size when teaching Visual Studio? Try this new miracle tool from Mark Russinovich and SysInternals Team (now on Microsoft payroll).

ZoomIt 2.0 sits in the system tray, waiting for you to press CTRL + 1, and then zooms the entire screen, seamlessly and extremely fast. You can pan around the zoomed area by moving the mouse. To zoom in and zoom out, use the mouse wheel.


And it just weighs 142 KB! Get it here.

Visual Studio 2008 Now Has VSeWSS Tools, Too!

Excellent news! The SharePoint team has released the Visual Studio Extensions for Windows SharePoint Services (VSeWSS) version 1.2. The only update is that it supports VS2008 and VS2008 only.

The previous version (1.1) worked only with VS2005, so if you have the new incarnation of Visual Studio, download this new version and the user guide, and start coding.

If, however, you still use VS2005, stick with the good old VSeWSS 1.1.

IE and The Mysterious ‘The page took too long to save’ Message

Another one of those “oh my god” moments in SharePoint programming, although it had nothing to do with SharePoint proper.

The Background

I want to dynamically add a DIV alongside a SharePoint field in Publishing page. The intended purpose is to extend the built-in control without any server-side code. I want the DIV to hold a simple hand-crafted AJAX call to add new items.

Everything is okay, I add my code to the SharePoint _spBodyOnLoadFunctionNames.push function, I find the control to be extended and I yank the DIV from its previous location to the parentNode object of the control. It nicely shows the new DIV below the original control:


The DIV contains an anchor element that has href=”#” and onclick=”SomeFunction();”. It’s created dynamically when the page loads:

var link = document.createElement("a");
link.innerHTML = "Agregar nuevo elemento";   
link.onclick = "SomeFunction();";

The Symptoms

When you click the anchor in the added DIV, there’s a 30-second pause during which IE responds to no clicks, after which the following message appears:

Are you sure you want to navigate away from this page?

The page took too long to save. You can click “Cancel”, and then try to save the page again. If you click “OK”, you might lose unsaved data.

Press OK to continue, or Cancel to stay away on the current page.


After you click OK, the anchor works well, calling the SomeFunction flawlessly.

The First Suspect

I though that the issue was caused by another function I called, that uses “AJAX” call to owssvr.dll to filter cascading dropdown controls (more on that in next posts). It might leave the HTTP request in a undefined state so that the IE thinks it’s still not loaded.

I commented it out but the error persisted.

The Second Suspect

Then I thought that it has something to do with the appendChild method I use to move the DIV from its placeholder to the new position below the control it’s extending.

I changed the call to dynamically create a new DIV instead of moving the old one to a new position in DOM tree. But, the same error persisted.

The Real Culprit

After David Gutiérrez, one of my colleagues (whose mileage in JavaScript is much greater than mine) revised the code, and after a perfunctory “brain processing” period (which lasted about an hour, in this case), he appeared and outlined the malfunction.

The error message is caused by IE trying to “execute” the new onClick event, which is set to a JavaScript function in this case. But, the syntax is wrong, wrapped inside double-quotes, like in inline HTML.

link.onclick = "SomeFunction();";

The correct syntax is written just like a method call, using only the function name:

link.onclick = SomeFunction;

IE seems to “compile” the string into a method call, but only after you confirm that you want to navigate away. Weird enough.

New SharePoint Training Content

If you are comfortable in .NET development but SharePoint has always been a murky water for you, check out the new MSDN content tailored especially for wannabe SharePoint developers.

It contains whitepapers, screencast, hands-on labs, virtual labs, demos and presentations to get you into SharePoint programming world in no time.