Saturday, March 6, 2010

New Books about Sharepoint 2010

I just added over 30 new books about SharePoint 2010 to my Amazon Store. Most are not available yet, but a few are. Be the first to get these exciting books and place your order today.

The new SharePoint 2010 books can be found here:
http://astore.amazon.com/moss-books-20?node=7

Tuesday, August 18, 2009

Compare Document Versions in Word 2007 with SharePoint

Sharepoint includes a feature to track a document's version history. You can see this history from Word 2007 by clicking on the Office Button and then selecting View Version History under Server.


Then you will get a window that shows all the different versions, their modified date, modifier, size and comments.


Highlight the version you want to compare and then click on the Compare button. Word will open the old version in a new window and then open another window that show both versions and their differences.


On the left you will see a list of the all the changes. In the center is the current document with the changes highlighted. On the right are both versions of the document. Now you have an easy and quick way to see the changes made in each version of the document.

Monday, May 4, 2009

Outgoing Email Settings for SharePoint Services

The SharePoint server I inherited would not send outgoing emails. The SMTP service was installed on the same server and all the settings looked correct. Well, that is what I thought until I ran through the instructions found in the TechNet site here:
http://technet.microsoft.com/en-us/library/cc287879.aspx

In the section for configuring the SMTP service, steps 8 and 9 talk about setting up the relay permissions. Make sure you either include the server name of the localhost or select the All excepts the list below option. You would think that localhost would be able relay through its own server without any changes to the settings, but that is not the case.

Tuesday, March 17, 2009

An unhandled exception has occurred

We have been working on installing Business Portal for Great Plains on our SharePoint Server. One of the 1st things I noticed was that the programmers did not handle errors very well in their code. It has been very common to run into an "unhandled exception has occurred" error when trying to load a page.

Here is one error we started getting after our consultants installed an add-on to Business Portal (that is a different story):
Exception type: FileNotFoundException Exception message: Retrieving the COM class factory for component with CLSID {58737586-7149-11D4-9BB0-00A0CC359411} failed due to the following error: 8007007e.

Now this is from the Application Event Log, but the same message is displayed in the browser.

I was not able to find any useful information with Google and our consultants who installed Business Portal with our Great Plains installation had no idea. So after waiting a week, I started to dig a little deeper myself.

The error says that a file was not found, but does not give the name of the file. However, I was able to find the CLSID {58737586-7149-11D4-9BB0-00A0CC359411} in the registry under the HKEY_CLASSES_ROOT\CLSID folder. In that folder was an InprocServer32 folder with a default key. This key contained the path to the GPReg.dll file, but was pointing the D rive, which is the CD-ROM drive on the server. I did a quick search on the C drive, found the file and fixed the path in the registry. After restarting IIS, my error was gone.

Saturday, March 7, 2009

Debugging SharePoint

The default error messages in SharePoint are not useful, and that is being nice. Fortunately, there is a way to turn on error messages that provide more information. The following blogs postings give all the details:


Happy debugging.

Thursday, February 26, 2009

Recreating a Column in SharePoint's User List

I did something really stupid. I wanted to customize the columns in the User Information List and decided that I did not need the Department column. Normally you can't delete the Department column, but a quick Google search pointed me to a tool called SharePoint Manager 2007(SPM). Using SPM, I was able to change the flag that was preventing me from deleting the Department column. Less than two minutes after deleting the Department column I started getting complaints about errors when trying to edit list items. It turns out that you really can't delete the Department column. What made this mistake even more stupid was that I did not make a backup of the site before playing with the User Information List.

The first thing I tried was to recreate the column with the web interface. Even if you name the column "Department", there is something different and you are still left with a broken site. After weeks of digging through Google and analyzing the SharePoint database, I was finally able to discover a method to create the original Department column and fix my errors. What made my fix possible were the export, import and update field tools created by Gary Lapointe.

Here are the steps I followed:
  1. Create new site collection with a new top level site. This creates a new User Information List with the Department column.
  2. Run gl-exportlistfield on the new site to get the XML for the department column. The command I used was:
    stsadm -o gl-exportlistfield -url "http://sharepoint:1234/_catalogs/users/detail.aspx" -fielddisplayname "Department" -outputfile "c:\backups\usersList"

  3. Run gl-importlistfield on the broken site to recreate the department column. The command I used was:
    stsadm -o gl-importlistfield -url "http://sharepoint/_catalogs/users/detail.aspx" -inputfile "c:\backups\usersList"
After running those two commands, the Department column was restored and my errors were resolved. Gary Lapointe has created some very useful addons to the stsdm command line tool. His blog is a must read for anyone managing a SharePoint server. More information can be found on his blog at http://stsadm.blogspot.com/.

Friday, February 20, 2009

Download a File Using the SharePoint Copy Web Service

Here is a code sample I put together to download a file from a Document Library using SharePoint's Copy web services.
// sharepoint is a web reference that points to http://sharepoint/_vti_bin/copy
sharepoint.Copy myCopyService = new sharepoint.Copy();
myCopyService.Credentials = System.Net.CredentialCache.DefaultCredentials;

// URL to the file you want to downlaod
string copySource = "https://sharepoint/file.doc";

// Define the variables that will store the output from the web service call
sharepoint.FieldInformation myFieldInfo = new sharepoint.FieldInformation();
sharepoint.FieldInformation[] myFieldInfoArray = { myFieldInfo };
byte[] myByteArray;

// Call the web service
uint myGetUint = myCopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);

// Convert into Base64 String
string base64String;
base64String = Convert.ToBase64String(myByteArray,0,myByteArray.Length);

// Convert to binary array
byte[] binaryData = Convert.FromBase64String(base64String);

// Create a temporary file to write the text of the form to
string tempFileName = Path.GetTempPath() + "\\" + myFieldInfoArray[0].Value;

// Write the file to temp folder
FileStream fs = new FileStream(tempFileName, FileMode.CreateNew, FileAccess.ReadWrite);
fs.Write(binaryData, 0, binaryData.Length);
fs.Close();

//Open file in default program
System.Diagnostics.Process.Start(tempFileName);

There is more information on the Copy web service here: http://msdn.microsoft.com/en-us/library/copy.aspx. Look under the Copy class and its GetItem method.