More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  Scot's SharePoint StuffProfileFriendsBlogMore Tools Explore the Spaces community

Scot's SharePoint Stuff

The good, the bad, and the ugly
No list items have been added yet.
July 30

Creating a Scope and Tab for MOSS Search Center

I am occasionally asked how to create a tab in the MOSS Search Center to search a given scope. This process is often confusing to administrators because it involves the creation of a scope, making the scope available, and then the creation of not just one, but two tabs in Search Center along with ASPX pages. Before beginning, this article assumes that you already have the Shared Services Provider (SSP) properly set up and that you have a "Search Center with Tabs" site available in your portal. For my example, I'll create a tab designed to search a specific document library that contains HR documents. Note that this article does not cover creating an "Advanced Search" capability - just a simple keyword search.

HRDocuments

Create the Shared Scope

The first step is to create a Shared Scope that will target the document library. This Shared Scope will be set up in the Shared Services Provider using the following steps:

  1. On the home page of the Shared Services Administration site, click "Search Settings"
  2. On the Search Settings page, click "View Scopes"
  3. On the View Scopes page, click the "New" button
  4. On the Create Scope page
    - Enter HR Documents in the Title field
    - Leave the results page using the default page, you'll change that later
    - Click the OK button.
  5. On the View Scopes page, locate the new scope and click the "Add Rules" link
  6. On the Add Scope Rule page
    - Set the Scope Rule Type to "Web Address"
    - Set the Web Address to "Folder"
    - Enter the complete URL to the Document Library (e. g. , http://litwareinc.com/HR/HR%20Documents).
    - Click the OK button.
  7. Return to the Search Settings page
  8. Under the Scopes section, click the "Start Updates Now" link

When you have completed creating the scope and updating it, you should be able to see that it contains a number of documents. This is a good check that you have created the scope correctly and it contains the number of documents that you expect.

CompletedScope

Make the Shared Scope Available in the Site Collection

An optional step is to make the new scope available to the site collection where the Search Center is located. Follow these steps to do that:

  1. From the home page of your portal, select Site Actions>>Site Settings>>Modify All Site Settings
  2. On the Site Settings page, under the Site Collection Administration page, click the "Search Scopes" link

On the View Scopes page, you should see the new scope listed under the Unused Scopes section. At this point, you could easily add the scope to the Search Dropdown that appears at the top of the page in MOSS by clicking on the "Search Dropdown" link appearing in the "Display Group: Search Dropdown" section. However, our goal is to create a tab for the search scope.

Create the Search Center Tab

New tabs for Search Center involve several different parts. First, you must create a search page. Then you must create a search results page. Finally, you must associate the scope with the new pages and create tabs to display them. Follow these steps to get it all working:

  1. From the Search Center page, select Site Actions>>Create Page
  2. On the Create Page
    - Enter HR Documents Search in the Title field
    - SharePoint should automatically generate a valid page name
    - Select "Search Page" from the list of available Page Layouts
    - Click the Create button
  3. A new page should now be visible with a Search Box web part
    - Select Modify Shared Web Part from the web part's edit menu
    - Expand the Miscellaneous section
    - Enter HRDocumentsResults.aspx in the Target Search Results Page URL field (you will create this page next)
    - Uncheck the box labeled "Display Advanced Search Link"
    - Click the OK button
    - Click the Publish button at the top of the page
  4. From the new page, select Site Actions>>Create Page
  5. On the Create Page
    - Enter HR Documents Search Results in the Title field
    - SharePoint should automatically generate a valid page name
    - Select "Search Results Page" from the list of available Page Layouts
    - Click the Create button
  6. A new page should now be visible with a several search web parts
    - Select Modify Shared Web Part from the Search web part's edit menu
    - Expand the Miscellaneous section
    - Enter HRDocumentsResults.aspx in the Target Search Results Page URL field
    - Uncheck the box labeled "Display Advanced Search Link"
    - Click the OK button
    - Select Modify Shared Web Part from the Search Core Results web part
    - Expand the Miscellaneous section
    - Enter HR Documents in the Scope field
    - Click the OK button
    - Click the Publish button at the top of the page
  7. From the new page, select Site Actions>>View All Site Content
  8. On the All Site Content page, click the "Tabs in Search Pages" link
  9. On the Tabs in Search Pages list, click the New button
  10. On the New Item page
    - Enter HR Documents in the Tab Name field
    - Enter HRDocumentsSearch.aspx in the Page field
    - Click the OK button
  11. From the list, select Site Actions>>View All Site Content
  12. On the All Site Content page, click the "Tabs in Search Results" link
  13. On the Tabs in Search Results list, click the New button
  14. On the New Item page
    - Enter HR Documents in the Tab Name field
    - Enter HRDocumentsSearchResults.aspx in the Page field
    - Click the OK button

Return to the Search Center home page and you should now see a new tab visible for HR Documents.

Search

Try out a search and verify the expected results.

Results

July 06

Is VSeWSS 1.2 Ready for Prime Time?

Microsoft recently released Visual Studio Extensions for Windows SharePoint Services v1.2. As many of you know, I have been lukewarm about VSeWSS since its first release. I have written articles describing other development approaches including Ted Pattison's STSDEV tools, Andrew Connell's CodeRush toolset, and even my own development methodology. So I thought it was time to revisit VSeWSS given that this latest release finally works in Visual Studio 2008. My conclusion? Although VSeWSS continues to make progress, it just does not cover enough of the functionality professional SharePoint developers need. My detailed review follows.

Preparing the Development Environment

Installation of VSeWSS v1.2 is simple. All you have to do is download the software onto your development machine (where VS2008 is located) and run the installation. As far as documentation goes, you can simply use the v1.1 documentation because v1.2 simply added VS2008 support whereas v1.1 was just for VS2005. When you start VS2008, you will find several new SharePoint projects available:
 
  • Team Site Definition
  • Blank Site Definition
  • Web Part
  • List Definition
  • Empty Project
This set of projects has always been one of my first complaints about VSeWSS. When I create SharePoint solutions, I almost never create site definitions anymore. We used to create a lot of site definitions in the 2003 version of SharePoint, but in the 2007 version we have custom features. "Stapling" a custom feature to an existing site definition is the best practice - not creating new site definitions. So right away, you can see that there is no "Feature" project or "Staple" project. In my opinion, this gets people going in the wrong direction right off the bat. Later, you'll see that VSeWSS considers a "Feature" to be a packaging mechanism. I'm OK with this idea, but if you are new to SharePoint development, this set of projects is really misleading.
 
I do, of course, create a lot of list definitions and web parts for my solutions, so I like these projects. However, we're also missing Feature Receiver, Event Receiver, Custom Action, and Content Type projects. So for these, you just have to use the Empty project template and add items in later. While this may not be a big deal technically, I certainly wish they were all "first class" project types. My conclusion here is that 90% of the time, you'll simply start with an empty project template. This, as you'll see, can lead to difficulties.
 
ProjectDialog
 
Once you have a project opened, you can add several different items to it. These items represent many of the different solutions you'll want to build in SharePoint, but certainly not all of them. The set of project items represents a good start, and I am sure they will grow over subsequent releases. However, you still have to know how to create other types of items that may not be covered here such as a Feature Receivers.
 
  • Content Type - simple enough, allows you to create a new content type
  • List Definition - creates a list definition from scratch
  • List Definition from Content Type - creates a list definition that uses a defined content type
  • List Instance - creates an instance of a list in SharePoint based on the definition you create
  • Field Control - creates a control for interacting with a field in a list
  • Web Part - a web part, of course
  • Module - a mechanism for provisioning files into SharePoint
  • Template - a mechanism for provisioning files in the System (12) directory
  • Event Receiver - a class to receive list events
 
 ItemDialog
 

Creating a Solution

 
For my review, I simply tried to recreate the CentralAdminLink I demonstrated previously when discussing my own development methodology. This project does nothing more than add a link to the Site Actions menu to open the Central Administration site, but it allows us to exercise some of the basic development functions. This project only requires a Feature.xml file and an Elements.xml file with a CustomAction element. I found that VSeWSS had a difficult time handling this simple project because it was not based upon one of the pre-defined project templates.
 
In order to create my Elements.xml file, which contained the CustomAction definition, I had to create a blank project and add a Module item to the project. I was able to rename the Module item to "Elements.xml" and edit it by hand to create the CustomAction. Throughout this process, however, VSeWSS didn't do anything to help me create the CustomAction. The development effort was still primarily hand-coding XML files except now I had to constantly try and keep the project in sync with the toolset so that I could later build a WSP package for deployment.
 
After I got the Elements.xml file created, I was then able to switch to the WSP view to create the Feature.xml file. When I switched to this view, I was given a Manifest.xml and a Feature.xml file for free. Initially that seemed nice, but VSeWSS kept wanting to put an "Assemblies" entry in the Manifest.xml file so it could deploy the project DLL. The only problem, of course, is that this project has no assembly! My attempts to edit Manifest.xml were unsuccessful as the WSP builder kept putting the entry back. Ultimately, you can go to the file system directly and modify the structure, but I fail to see how this is easier than the other methodologies I have mentioned in this article.
 
WSPBuilder
 
When I built the project, VSeWSS did create my WSP file, but this file contained the assembly that I tried so hard to remove! Also, the deployment of the feature did not work because I had not used one of the built-in templates. In order to deploy the feature, I was forced to use STSADM commands by hand.
 
All-in-all, I think that this toolset will continue to mature, and I have no doubt that one day it will be the only toolset we need. Right now, however, I'd have to say that I'm sticking with my current approach. I would also strongly recommend that you learn how to create all of the possible SharePoint solutions before adopting this toolset because it does not support every one of them directly.
 
April 29

Troubleshooting SharePoint: When Good Servers Go Bad

This article is a summary of my presentation at Office Connections held in Orlando April 30, 2008. It summarizes the most-common issues with SharePoint, how to avoid them, and how to fix them. Here is a list of topics:

  • Install Service Pack 1
  • Runaway Transaction Logs
  • Runaway SharePoint Logs
  • Protected Memory Errors
  • IISWAMREG Admin Service Errors
  • Timer Job Errors
  • Update Conflicts
  • Performance Issues
  • Customization Errors
  • Security Errors

 

Install Service Pack 1

The first recommendation is to make sure that you have SP1 installed. SP1 has over 2500 fixes, and can go a long way to helping you avoid issues.

WSS SP1 Download

MOSS SP1 Download

 

Runaway Transaction Logs

One of the most common issues with SharePoint farms is runaway transaction logs associated with the SQL Server databases. This is really not a SharePoint issue, but a SQL Server issue. This issue is caused by the fact that most SharePoint databases are created in Full-Recovery mode. This means that SQL Server retains a log of every transaction that occurs on the database since the last database backup. If you never backup your SharePoint databases, then the transaction log will continue to grow until all the disk space is used up.

Symptoms

  • Little or no available disk space on SQL Server
  • Huge transaction log files

Recovery

Step 1: Backup the Transaction Log manually from the UI. This will truncate the log, but not shrink it.

From http://support.microsoft.com/kb/873235

When the transaction logs grow to an unacceptable limit, you must immediately back up your transaction log file. While the backup of your transaction log files is created, SQL Server automatically truncates the inactive part of the transaction log. The inactive part of the transaction log file contains the completed transactions, and therefore, the transaction log file is no longer used by SQL Server during the recovery process. SQL Server reuses this truncated, inactive space in the transaction log instead of permitting the transaction log to continue to grow and to use more space.

Step 2: Manually shrink the log file from the UI.

From http://support.microsoft.com/kb/873235

The backup operation does not reduce the log file size. To reduce the size of the transaction log file, you must shrink the transaction log file. To shrink a transaction log file to the requested size and to remove the unused pages, you must use the DBCC SHRINKFILE operation. The DBCC SHRINKFILE Transact-SQL statement can only shrink the inactive part inside the log file.

Prevention

Option 1: Switch to Simple recovery Mode for non-production SharePoint databases.

This will prevent the transaction log from growing because simple recovery mode does not keep transaction history. Use the following SQL Statement:

USE Master
SELECT Name, Recovery_Model_Desc FROM Sys.Databases

ALTER DATABASE [name] SET RECOVERY SIMPLE WITH NO_WAIT

Option 2: Create a database maintenance plan for all SharePoint databases

Creating the Database Maintenance Plan

1. Open SQL Server Management Studio

2. Right click the SQL Server Agent and select Start from the context menu.

3. Expand the tree and select Management►Maintenance Plans

4. Right click the Maintenance Plans folder and select Maintenance Plan Wizard from the context menu.

5. On the Welcome screen, click the Next button.

6. On the Select Plan Properties screen, name the plan “MOSS Maintenance”

7. Click the Change button

8. Modify the schedule (daily recommended) and click the OK button.

9. Click the Next button

10. On the Select Maintenance Tasks screen, check the following tasks:

  • Check Database Integrity
  • Reorganize Index
  • Update Statistics
  • Clean Up History
  • Backup Database (Full)

11. Click the Next button.

12. On the Select Maintenance Task Order screen, click the Next button.

13. On the Define Database Check Integrity Task screen, drop the list and select all of the SharePoint databases.

14. Check the Include Indexes box.

15. Click the Next button.

16. On the Define Reorganize Index Task screen, drop the list and select all of the SharePoint databases.

17. Check the Compact Large Objects box.

18. Click the Next button.

19. On the Define Update Statistics Task screen, drop the list and select all of the SharePoint databases.

20. Select the All Existing Statistics option.

21. Select the Full Scan option.

22. Click the Next button.

23. On the Define History Cleanup Task screen, click the Next button.

24. On the Define Back Up Database (Full) Task screen, drop the list and select all of the SharePoint databases.

25. Check the box titled “Create a subdirectory for each database”.

26. Change the backup location, if desired.

27. Click the Next button.

28. On the Select Report Options screen, click Next.

 

Creating the Transaction Log Maintenance Plan

If this installation is not a production environment, consider changing the recovery mode for all databases to SIMPLE using the following
ALTER DATABASE [name] SET RECOVERY SIMPLE WITH NO_WAIT

1. Open SQL Server Management Studio

2. Right click the SQL Server Agent and select Start from the context menu.

3. Expand the tree and select Management►Maintenance Plans

4. Right click the Maintenance Plans folder and select Maintenance Plan Wizard from the context menu.

5. On the Welcome screen, click the Next button.

6. On the Select Plan Properties screen, name the plan “MOSS Log Maintenance”

7. Click the Change button

8. Under the Frequency section, Select Daily from the Occurs drop-down list

9. Under the Daily frequency section, select the Occurs Every option.

10. Set the Start Time to 9:00:00 AM.

11. Set the End Time to 5:30:00 PM

12. Click the OK button.

13. Click the Next button.

14. On the Select Maintenance Tasks screen, check Backup Database (Transaction Log)

15. Click the Next button.

16. On the Select Maintenance Task Order screen, click the Next button.

17. On the Define Back Up Database (Transaction Log) Task screen, drop the list and select all of the SharePoint content databases.

SSP, WSS Search and MOSS Search databases are set to simple recovery model, so their transaction logs will not grow.

18. Check the box titled “Create a subdirectory for each database”.

19. Change the backup location, if desired.

20. Click the Next button.

21. On the Select Report Options screen, click Next.

 

Runaway SharePoint Logs

Another area where disk space can be used up quickly is through the SharePoint Unified Logging Service (ULS). The ULS writes text-file logs to the LOGS folder in the System Directory (\Program Files\Common Files\Microsoft Shared\web server extensions\12).

Symptoms

Many large text files located in the LOGS directory

Recovery

Delete old files to regain space as necessary

Prevention

  • Throttle the logging service by opening Central Administration, clicking the "Operations" tab and going to "Diagnotic Logging". On the Diagnostic logging page, throttle the logged events by selecting a minimum level of severity for logging.
  • Make use of the LogViewer feature to examine logs. This adds a log viewing utility to Central Admin.

 

Protected Memory Errors

This error shows itself as several different errors in the Event Log all saying that SharePoint attempted to read or write protected memory.

Symptoms

  • Event Log entries: Attempted to read or write to protected memory
  • Can’t open IIS Manager
  • Can’t make new web applications

Recovery & Prevention

 

IISWAMREG Admin Service Errors

Symptoms

In the Event Log, you see the following:

Type: Error
Source: DCOM
Category: None
Event ID: 10017
Description:
The application-specific permissions settings do not grant Local Activation permission for the COM Server application with CLSID {CLSID} to the user DomainName\UserName SID {SID}. This security permission can be modified using the Component Services administration tool.

Recovery & Prevention

1.    Click Start, click Run, type dcomcnfg in the Open box, and then click OK.
2.    Expand Component Services, expand Computers, expand My Computer, and then click DCOM Config.
3.    Right-click IIS WAMREG admin Service, and then click Properties.
4.    Click the Security tab.
5.    Under Launch and Activation Permissions, click Edit.
6.    In the Launch Permission dialog box, click Add.
7.    In the Select Users, Computers, or Groups dialog box, type the domain user account that you specified as the Windows SharePoint Services 3.0 service account, click Check Names, and then click OK.
8.    In the Permissions for UserName list, click to select the Allow check box that is next to Local Activation, and then click OK two times.

Here are some additional references:

http://support.microsoft.com/kb/920783

http://blogs.vertigo.com/personal/steventap/Blog/Lists/Posts/Post.aspx?ID=21

 

Timer Job Errors

There are two timer services in SharePoint that are responsible for running various jobs that keep the farm healthy. If you have issues with these services, then you may see these jobs fail.

Symptoms

  • Failed jobs in Central Admin
  • Installed solutions fail to deploy
  • Created web apps fail to create on every server

Recovery

  1. Recycle "Windows SharePoint Services Timer" and "Windows SharePoint Services Administration" on every server in the farm.
  2. Run stsadm -o execadmsvcjobs on every server in the farm

Prevention

To prevent these issues, create a batch file that periodically recycles the services.

1. Open NotePad and add the following lines:

NET STOP "Windows SharePoint Services Timer"
NET START "Windows SharePoint Services Timer"
NET STOP "Windows SharePoint Services Administration"
NET START "Windows SharePoint Services Administration"
STSADM -o ExecAdmSvcJobs

2. Save the file as "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\RecycleSharePointServiceTimer.bat"
3. Select Control Panel►Scheduled Tasks►Add Scheduled Task.
4. In the Schedule Task Wizard, click the Next button.
5. Click the Browse button and locate the file "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\RecycleSharePointServiceTimer.bat."
6. Select to perform the task daily and click the Next button.
7. Schedule the task to start at 4:00 AM Every Day and click the Next button.
8. Enter credentials for executing the task and click the Next button.
9. Check the box to open the Advanced Properties and click the Finish button.
10. Click the Schedule tab and then click the Advanced button.
11. Check the Repeat Task box.
12. Schedule the task to repeat every 4 hours.
13. Select the Time option and enter 3:00AM.
14. Click the OK button.
15. Click the OK button.

 

Update Conflicts

Whenever you update SharePoint system passwords, you can have issues with SharePoint being able to access databases and run jobs.

Symptoms

In the Event Log, you see the following error:

An update conflict has occurred, and you must re-try this action. The object SPApplicationPool Name=SharePoint Central Administration v3 Parent=SPWebService Name=WSS_Administration is being updated by {...}, in the STSADM process, on machine {...}.  View the tracing log for more information about the conflict.

Recovery & Prevention

Clear the File System cache on the SharePoint front end servers using this procedure: (From http://support.microsoft.com/kb/939308).

1. Stop the Timer service. To do this, follow these steps:

    a.  Click Start, point to Administrative Tools, and then click Services. 
    b.  Right-click Windows SharePoint Services Timer, and then click Stop.

2. Delete or move the contents of the following folder:
    %ALLUSERSPROFILE% \Application Data\Microsoft\SharePoint\Config\GUID
3. Start the Timer service. To do this, follow these steps:

    a.  Click Start, point to Administrative Tools, and then click Services. 
    b.  Right-click Windows SharePoint Services Timer, and then click Start.

Note The file system cache is re-created after you perform this procedure. Make sure that you perform this procedure on all servers in the server farm on which the Timer service is running.

Here's a great article on password changes for SharePoint: http://blogs.msdn.com/joelo/archive/2006/08/22/712945.aspx

 

Performance Issues

Various performance issues like slow page loads.

Symptoms

  • Slow Page loads

Recovery

  • Reduce number/complexity of web parts
  • Evaluate lists
  • Evaluate web part architecture

Prevention

  • Control number of web parts
  • Delete unused web parts
  • List Maintenance (2000 Items, Indexed columns)
  • Avoid programming pitfalls (undisposed objects, excessive looping)
  • Enable caching

<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="true" />

 

Customization Errors

Symptoms

  • Generic SharePoint Error Page

Recovery

  • Add "?contents=1" to the web of the web page request to open web part management page. Delete offending web part
  • Restore default master page if your custom one is causing the problem.
  • Deactivate offending feature
  • Disable custom errors by editing web.config file by making the following changes:

<compilation batch="false" debug="true">

<customErrors mode="Off" />

<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

Prevention

  • Implement a Dev->QA->Production process

 

Security Errors

Symptoms

Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed

Recovery

Adjust security policy in web.config file as follows:

<trust level="WSS_Medium" originUrl="" />

Prevention

Implement custom security policies on all web parts. Start with Dan Larson's blog entry on the topic.

April 27

Making Excel Services and Excel Work Better Together

I just completed an MSDN article that focuses on making the Excel Services experience more like the Excel client experience when importing two-dimensional data for analysis. The idea was to provide similar capabilities in Excel Services for importing, analyzing, and displaying imported data. If you're looking to use Excel Services as a reporting platform or as the basis for dashboards, check out this article.

April 03

Disposing SPWeb and SPSite

Read this great article by Roger Lamb and become a better SharePoint developer.

View more entries
 
Thanks for visiting!
  • View space
    Scot Hillier
    March 10 10:57 AM
    Didn't work for any column or didn't work if you wanted the business data column to be unique?
  • View space
    March 10 9:47 AM
    Love your stuff Scott, and your MOSS book.  This is a great feature to fix a common need.   I installed the unique policy and it works great, but I did find an issue with it.
     
    It does not seem to work if the list has a Business Data column in it.

Scot Hillier

View spaceSend a message
Occupation:
Scot Hillier is an independent consultant and Microsoft Most Valuable Professional focused on creating solutions for Information Workers with SharePoint, Office, and related .NET technologies. He is the author of 10 books on Microsoft technologies including “Microsoft SharePoint: Building Office 2007 Solutions in C# 2005”. When not writing about technology, Scot can be found presenting at industry conferences such as Microsoft Tech Ed and SharePoint Connections. Scot is a former U. S. Navy submarine officer and graduate of the Virginia Military Institute. Scot can be reached at scot@shillier.com.
View space
Bill Baer
View space
Russ Fustino
View space
Rick Taylor
View space
Catto