Category Archives: SharePoint 2007

Public Facing SharePoint Sites

Microsoft Office SharePoint Server 2007 and SharePoint 2010 provides document management, records management and web content management capabilities.    This means that with SharePoint you can create intranets, extranets and public facing web sites.

If you are looking for some great examples of public facing websites built on SharePoint check out the Silverlight live pivot demo at: http://www.wssdemo.com/livepivot/.   This Silverlight pivot display has over 2,000 public facing web sites that you can sort and filter through by country, industry, and platform.

I also have a PowerPoint document on my resources page with some additional samples of sites designs created for SharePoint 2010.

Building out very attractive SharePoint internet sites is not only possible but also uses the same skill sets that your existing .NET web developers and designers already have.

If you have a public facing site built upon SharePoint that you would like to show off, submit your site to Ian Morish who runs the www.wssdemos.com site.

If you work for a state or local government agency in the North-Central region of the U.S. and would like to have a discussion regarding public facing SharePoint sites please contact me!

October Cumulative Updates for Office and SharePoint

The cumulative update packages for October 2010 contain the latest hotfixes released by Microsoft for Office and SharePoint.

All of the packages for Office 2010 suites, Office 2010 servers, Search Server 2010, FAST Search Server 2010 for SharePoint, and SharePoint 2010 can be found in KB2449183 (http://support.microsoft.com/kb/2449183).

All of the packages released for Office 2007 suites, Office 2007 servers, Search Server 2008, and Windows SharePoint Services 3.0 can be found in KB2449128 (http://support.microsoft.com/kb/2449128).

I recommend that you test hotfixes before you deploy them in a production environment. Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous update package. I recommend that you consider applying the most recent fix release that contains the hotfix that you need.

To be notified of new Office and SharePoint cumulative updates, subscribe to the RSS feed at: http://services.social.microsoft.com/feeds/feed/officeandrelatedproductsupdates

SharePoint Lists Gadget by datapolis

datapolisGadget1Recently I was introduced to an interesting free Windows 7 / Vista desktop gadget for keeping track of information stored in SharePoint lists.  The gadget by datapolis, when in it’s compact form, displays the total number of items, unread items and new items in the lists that you have configured the gadget to watch.   If you switch the gadget to the larger view you can see specific details related to each list you are watching and you can also drill down and see the actual data in the lists.  

 

datapolisGadget2Configuring the gadget is very simple.  After adding the gadget to the desktop it will be displayed in a compact mode.  Clicking on the expand option (the arrow icon that points to the upper right) will display the larger view of the gadget.   If this is the first time using the gadget you will be required to enter in a registration key.  You can request a free registration key by using the link located immediately under the registration key text box.

After entering in the registration key you will be presented with a summary screen with 8 rectangles where you can define the SharePoint lists to watch. 

datapolisGadget3To define a list to watch, click on the add button next to one of the empty rectangles and then fill in the 3 required fields.   The tab name is any identifying name you wish to associate with the list.  The view address is the URL to the view of the list that you wish to monitor.  The authentication mode indicates how the gadget passes security credentials to SharePoint.   The gadget supports Integrated, Forms and Windows based authentication.   Once you have entered in the required information click  on save to add the list to the gadget.

 

Once a list has been defined within the gadget you should immediately see the all, unread and new details for the list in the summary view.

datapolisGadget5

Clicking on one of the defined lists will show the contents of that list right in the gadget.  If you click on a list item your default browser will open directly to the view form for that item.

datapolisGadget6

When you switch the gadgets view to the compact mode it will display a total count of all list items, all unread items and all new items.

datapolisGadget4

Conclusion
I can see many uses for this desktop gadget.  I have had several clients that use custom SharePoint lists for managing work requests and other data where they need to keep on top of the changes immediately.  This gadget would allow them to quickly see the new items that have been added without relying on email alerts or manually checking the site.   The gadget is simple to configure and easy to use.  Overall I think it is a great addition to the toolbox for any SharePoint user or administrator.

Download
You can download your own copy of this gadget by visiting the datapolis web site.

SharePoint Sideshow

Tom Donovan and Paul Stubbs just launched a new online show on Channel 9 called the SharePoint Sideshow.  The show will discuss topics around SharePoint, Office and Information Worker productivity. Tom and Paul will bring in experts from the Microsoft product team and others to deliver insider content for developers. This is a show for you in the SharePoint and Office community so they will deliver on topics that are top of mind at the time and try to help you navigate the vast amount of information out there in a concise and approachable format.

Head over to Channel 9 and check out their first episode where you will be introduced to the SharePoint Sideshow and discuss the question:  what is SharePoint Development?

http://channel9.msdn.com/shows/sharepointsideshow

Microsoft Security Bulletin MS10-070 – Important

Recently I blogged about a security vulnerability in ASP.NET.   On September 28, 2010, Microsoft released a security bulletin along with a set of patches to resolve this issue.

If you are running any ASP.NET applications, including SharePoint 2007 or 2010 you should review this bulletin and take the necessary steps for your environment.   As always, test any patches or updates in a QA environment before deploying into production.

Since this bulletin is classified as important it is recommended that you quickly evaluate and patch your environment as necessary.

Microsoft Security Bulletin MS10-070

Important: ASP.NET Security Vulnerability

Over the weekend a Microsoft Security Advisory was released about a security vulnerability in all versions of ASP.NET.   Scott Guthrie’s blog has complete details of this issue and a workaround to protect your sites.

It is important to remember that SharePoint 2007 and 2010 are .NET applications and therefore impacted by this issue.   Please carefully read all of the information on Scott’s blog and take the appropriate actions.

Any company that has a .NET application or SharePoint farm accessible from the Internet should immediately apply the workaround.

Update 9/22/2010 For SharePoint Users:  The Microsoft SharePoint Team Blog has new information related to this vulnerability and how to protect your farm

SharePoint 2007 – Manage Checked Out Files

One of the more confusing and incorrectly named settings option for a document library is “manage checked out files”.  At first glance you probably think that this feature will allow you to see every file that is checked out and to whom.  That was my first reaction and as I soon learned it is the wrong assumption.

First this link really doesn’t have any use if you don’t have the library set to require check out when editing files.  When requiring a file to be checked out prior to editing a rather interesting thing happens when a user chooses to upload a file to the document library.   The file is first uploaded into the library and marked as checked out to that user.  The user is then prompted to enter in required metadata and then he must click on the check-in button to make the file available to other users.    If the user uploading the file does not check the file in then it is left in a rather strange state.    The file is in the document library, however, no one except the person who uploaded the file can see it… including administrators!    

A couple of interesting side effects occurs as a result of this.  As an administrator you will see that the number of items displayed in a document library or returned as available using the SPList.Items.Count API may not equal the item count shown on the view all site content page (or with the SPList.ItemCount API).   If you notice that the counts do not match you should use the manage checked out files option to view the files that have been uploaded but not checked in.   As an administrator or document library owner you can take ownership of the files and either check them in or delete them.

Microsoft must have also decided that naming the feature “manage checked out files” was confusing.   In SharePoint 2010 Beta they have renamed the feature to “Manage files which have no checked in version".  

I have seen several posts on Microsoft’s MSDN forums about administrators trying to delete a custom document content type but the administrator keeps getting an error stating that the content type is still in use.   In almost every one of these posts the administrator states that all of the documents have been associated with a new content type and the old one is no longer in use.   What most of these individuals didn’t do is check the “manage checked out files”.  The administrator will most likely see that a file was uploaded into the library and by default associated with the content type he is trying to delete.   The administrator can take ownership of this file and either delete it or modify the content type association and check the file in.   Once this has been accomplished the administrator should be able to delete the old content type from the document library.

Hopefully this brief overview of the manage checked out files feature of a document library will save a SharePoint administrator a bit of time.

Creating a Personalized SharePoint 2007 Site Directory

Organizations that deploy Microsoft Office SharePoint Server 2007 for collaboration often find that the number of site collections and subsites grow very quickly.  It seems like it doesn’t take long for end users to figure out how flexible and easy SharePoint is for creating simple “applications”.   Even with a good taxonomy and solid governance plan there is little that can be done to hold back the growth of a SharePoint environment.    This growth can make it complex and confusing for users to navigate to their sites.   One option is for the SharePoint administrators to manage a complex navigation hierarchy that supports every site in the farm.   Another option is for the users to use search to locate their sites, however, many users still seem to prefer browsing over search.   One solution I created to help address this is a personalized site directory.   This directory lists out all of the sites under a specific web application that the user has permissions to view.    This display is in alphabetical order based on site titles.  The display also has visual clues to show the relationships between sites and subsites.

To create this site directory I looked at many options.  The first and most obvious one is to use the SharePoint API to enumerate all of the sites in a web application and then look for the sites that the currently logged in user has permissions to view.   This could work, but would be very slow and processor intensive.   The option I elected to go with was using a custom query to the SharePoint search engine and then process the results.   Why search?  Simple, search is security trimmed.   I do not have to perform any additional logic to make sure I only locate sites that the user has permissions to view.  Search is also very fast.

My original version used SharePoint Designer and a DataView web part to submit a query to the SharePoint search web service.  An XSL stylesheet was then applied to the XML returned from the query to render the directory.   The problem with this was that the resulting directory listing was not in alphabetical order and maintaining visual clues about relationships between parent and child sites was difficult and did not always work properly.

I revisited my original idea and came up with a custom SharePoint web part that still uses a search query but then applies much more in depth logic to properly order and display links to the SharePoint sites.    So how did I create the personalized SharePoint site directory?

The first step is creating the proper query to send to the SharePoint search web service.   Below is an example query.   The variable server should contain the domain name of the web application you wish to use as the basis for the directory.  An example would be:  my.domain.com

string query = "<QueryPacket xmlns ="urn:Microsoft.Search.Query" Revision ="1000">";
  query+="<Query><Context><QueryText language ="en-US" type ="MSSQLFT">SELECT Title, url, contentclass";
  query+="FROM SCOPE() where (ContentClass =''sts_web'' or ContentClass =''sts_site'' or ";
  query+="contentClass =''sts_listitem_850'') and site ='2012-04-10 22:11:51'" + server + "'' and isDocument =0</QueryText>";
  query+="</Context><Range><StartAt>1</StartAt><Count>1000</Count></Range></Query></QueryPacket>";

This query uses contentClass to limit the results of the query to just publishing and team sites.   The <Count> parameter limits the maximum number of sites to return to 1000.   This could be adjusted if you have more sites to list, however, I would be very careful trying to display that many sites on a single web page.

Once the query is executed we receive a DataSet that contains a single DataTable with the query results.   As you can see by the query we only receive back title, URL and contentClass.   Before we can display our directory we need to figure out a way to relate each of the rows so we can display the parent / child relationship between sites and subsites.    To build this relationship I start by adding 3 new columns to our query results DataTable:

dt.Columns.Add(new DataColumn("id", typeof(System.Int32)));
dt.Columns.Add(new DataColumn("parentid", typeof(System.Int32)));
dt.Columns.Add(new DataColumn("origURL",typeof(System.String)));

The id column will hold a unique identifier for each record.   The parentid will hold the unique identifier of the parent record and the origURL will be used to hold the original URL to the site.    Once we have added the new columns we need to populate the id column with data.    I also store the original url in the origURL field and then modify the URL field slightly so I can more easily figure out parent / child relationships based on that URL.

for (int i = 0; i < dt.Rows.Count; i++)
{
    dt.Rows[i]["id"] = i + 1;
    dt.Rows[i]["origURL"] = dt.Rows[i]["URL"];
    dt.Rows[i]["URL"] = dt.Rows[i]["URL"].ToString().ToLower().Replace("/sites","");
    dt.Rows[i]["URL"] = dt.Rows[i]["URL"].ToString().ToLower().Replace("http://" + server, "");
}

After populating the id and origURL fields and making a few modifications to the URL field we can begin to update the parentid field.  This is accomplished by looping through all rows in the DataTable and using the select method on the DataTable to locate the parentid for each record.

for (int i = 0; i < dt.Rows.Count; i++)
{
    if (string.IsNullOrEmpty(dt.Rows[i]["url"].ToString()))
        dt.Rows[i]["parentid"] = 0;
    else
    {
        string parentURL = dt.Rows[i]["url"].ToString();
        parentURL = parentURL.Substring(0, parentURL.LastIndexOf("/"));

        DataRow[] rows = dt.Select("url=''" + parentURL + "''");
        if (rows.Length == 1)
            dt.Rows[i]["parentid"] = rows[0]["id"];
        else
        {
            rows = dt.Select("url=''''");
            if (rows.Length == 1)
                dt.Rows[i]["parentid"] = rows[0]["id"];
            else
                dt.Rows[i]["parentid"] = 0;
        }

    }
}

Now that we have a DataTable that contains all of our sites, including parent / child relationships we can create a recursive method for displaying the records in alphabetical order.   The method shown below first creates a DataRow array that contains all of the children for a specific parentID.   LINQ is then used to sort the child records based on Title.   Finally we loop through each of the rows in the sorted array and display the links for the sites.

private void showDirectory(DataTable dt, int parentID, int level)
{
    DataRow[] childs = dt.Select("parentid=" + parentID.ToString());
    level++;

    var sortedRows = from p in childs orderby p["title"] select p;

    foreach (DataRow child in sortedRows)
    {
        Controls.Add(new LiteralControl("&nbsp;".Repeat(level * 3)));
        if (level<3)
            Controls.Add(new LiteralControl("<b><a class=''ms-navheader'' href=''" + child["origurl"].ToString() + "''>" + child["title"].ToString() + "</a></b><br>"));
        else
            Controls.Add(new LiteralControl("<img src=''/_layouts/images/navBullet.gif'' alt='''' border=''0''>&nbsp;<a class=''ms-navitem'' href=''" + child["origurl"].ToString() + "''>" + child["title"].ToString() + "</a><br>"));
        showDirectory(dt, Convert.ToInt32(child["id"]), level);
    }

}

As you looked through the showDirectory method you might have noticed the .Repeat method being called on the string “&nbsp”.   This is an extension method that I wrote to return the original string repeated the number of times specified in the parenthesis.  In this case I am repeating a non-breaking space character so that the text is indented 3 characters for each level of the site hierarchy.  Shown below is the Repeat extension method used.    It could probably be made more efficient by using a StringBuilder object instead of using the += operator.

public static string Repeat(this string instr, int n)
{
    var result = string.Empty;
    for (var i = 0; i < n; i++)
        result += instr;
    return result;
}

Important note: With .NET Framework 3.5 SP1 all requests to a webservice located on the same server as the calling application may with a 401 unauthorized error.   There is a good article on blogs.iis.net that explains the issue and how to resolve.

Download example code here

The example code is intended to show how you could implement a similar directory.  The code may not compile or work as is in your environment.

InvalidDatabaseSchema failed during SharePoint PreUpgradeCheck

In service pack 2 for Microsoft Office SharePoint Server 2007 a new operation called PreUpgradeCheck was introduced for the STSADM command.  This operation uses the Microsoft Best Practices Analyzer to identity any issues that will need to be resolved prior to upgrading to SharePoint 2010.

Running the command is simple.  At a command prompt type:  stsadm –o preupgradecheck

This command will not make any modifications to your SharePoint farm.  Once the command is complete you will be presented with a nice HTML report.  The report contains a lot of great information and should probably be stored with your disaster recovery plan.

During a recent run of this command on a production server I received a “Failed” message on the InvalidDatabaseSchema check.   This means that the database schema for one of the content databases did not match the original SharePoint schema.    I was very surprised to see this since no one except for the DBAs had access to the server and no one should have been modifying the databases directly.

I opened up the LOG directory in the SharePoint hive and located the latest PreUpgradeCheck log file.  About 1/2 way down the log I found an entry related to the specific error.  It indicated that an extra table called “sysdiagrams” was found in the content database.    I immediately had my ah-ha moment.   Someone who had access to the server either accidentally or intentionally went into the Database Diagrams folder for the content database in SQL Server Management Studio (SSMS).  When they did this SSMS stated that one or more objects were missing that were required to use database diagramming and asked if they should be created.   Clicking “yes” would immediately create the sysdiagrams table.

To resolve the issue and return the database schema back to the original state I user SSMS and opened up the System Tables section of my content database and deleted the sysdiagrams table.    I went back and ran the PreUpgradeCheck and this time I got a clean report. 

Note: Do not make any modifications to database tables unless you have a full backup and you are confident you could recover in case of an unexpected issue.  Making modifications directly to SharePoint database tables which change the schema from the out of the box configuration may invalidate any support agreements you have with Microsoft.