Sunday, October 26, 2008

SPD Workflow: Start a workflow when the value of a certain field changes

A. Introduction A common requirement that I usually encounter is how to make a workflow start ONLY when a certain list item's field changes. Therefore, I decided to write this article to show how this can be achieved using SharePoint Designer and an auxiliary custom list. B. Scenario I have a custom list called Price List. This list contains four columns: - Product ID of type Single line of text - Product Description of type Single line of text - Price of type Currency - Availability of type Choice (Options are: Available, Out Of Stock) I would like to perform some actions (e.g. send a notification to a certain user) whenever the value of the Availability field for any item changes. C. Preparations - Create a new custom list called Aux Price List. - Rename the default Tile column to Product ID. - Create a new column called Availability of type Single line of text. D. Item Creation Workflow I will create a workflow that starts upon item creation. This workflow is responsible for copying the value of the Availability field to the Aux Price List. - Open Microsoft Office SharePoint Designer 2007. - Click File > Open Site. - Enter the URL of the site containing our custom list called Price List. - Now click File > New > Workflow. - On the Define your new workflow page, enter the following data:
  • Name: Backup Availability field
  • Attachment List: Price List
  • Start Options: Automatically start this workflow when a new item is created
- Click Next, in order to start designing the workflow steps. - Enter Copy data as the Step Name. - In the Actions section, select the action Create List Item. - Click the this list link. - Select Aux Price List in the List field. - Click the field Product ID and then click the Modify button. - In the To this value, click fx. For the source select Current Item and for the field select Product ID. - Click OK. - Click the Add button. For Set this field, select Availability. - In the To this value, click fx. For the source select Current Item and for the field select Availability. - Click OK. - Click OK to save and close the Create New List Item window. - Click Finish, in order to save and publish the workflow. E. Item Update Workflow This workflow is the one that performs some business related tasks when the Availability value of an item changes. Thus, this workflow will start only when items are changed. - Open Microsoft Office SharePoint Designer 2007 - Click File > Open Site. - Enter the URL of the site containing our custom list called Price List. - Now click File > New > Workflow. - On the Define your new workflow page, enter the following data:
  • Name: React on Availability Change
  • Attachment List: Price List
  • Start Options: Automatically start this workflow whenever a new item is changed
- Click Next, in order to start designing the workflow steps. - Enter Test the Availability field for change as the Step Name. - In the Conditions section, select Compare Price List field. - Click the field link and select Availability. - Leave the operator as equals. - Click the value link and then click fx. - For the Lookup Details, select... -- Source = Aux Price List -- Field = Availability - For the Find the List Item, select... -- Field = Aux Price List: Product ID -- Value = Click fx. For the source select Current Item and for the field select Product ID. - Click OK to save the lookup. - A warning message gets displayed. Click Yes to continue. - In the Actions section, select the action Stop Workflow. - Click the this message link and type the text: Workflow stopped because the Availability field has not changed. - Click the Add 'Else If' Conditional Branch. - In the Else branch add the action Log to History list. - Click the message link and type the text: The Availability field has changed. - Add the action Update List Item. - Click the this list link. - Select Aux Price List in the List field. - Click the Add button. For Set this field, select Availability. - In the To this value, click fx. For the source select Current Item and for the field select Availability. - Click OK. - In the Find the List Item, select ... -- Field = Aux Price List:Product ID -- Value = Click fx. For the source select Current Item and for the field select Product ID. - Click OK to save and close the Update List Item window. - A warning message gets displayed. Click Yes to continue. - Now you can add further steps for handling the event of changing the Availability field, e.g. Send an Email. - Click Finish, in order to save and publish the workflow. F. Test the solution 1. Create a new item. -- Check that the Backup Availability Field workflow has completed successfully. -- Check that the data of the new item is copied correctly to the Aux Price List. 2. Edit the created item by changing any field other than the Avilability. -- Check that the React on Availability Change workflow has completed successfully. -- Check that the History Log displays the comment: Workflow stopped because the Availability field has not changed. 3. Edit the created item by changing the Availability filed. -- Check that the React on Availability Change workflow has completed successfully. -- Check that the History Log displays the comment: The Availability field has changed. -- Check that the corresponding item in the Aux Price list has been updated correctly. G. Related articles SharePoint Designer Workflows: How to Tell Which Fields Have Changed

Tuesday, October 21, 2008

MOSS Administration: Uninstall guide for MOSS 2007

In this article I would like to describe the steps you need to follow, in order to uninstall Microsoft Office SharePoint Server properly. 1. Remove the server from the farm
  • Open SharePoint Central Administration.
  • Browse the Operations tab.
  • Click Servers in farm under Topology and Services.
  • Click Remove Server. Note that after removing the server, you would get and error page.
2. Delete the different databases
  • Shared Services Provider database (e.g. SharedServices1_DB and SharedServices1_Search_DB)
  • Config database (e.g. SharePoint_Config)
  • Content databases (e.g. WSS_Content_Intranet, WSS_Content_MySite, WSS_Content_SSPAdmin and SharePoint_AdminContent_ID)
  • Search database (e.g. WSS_Search_ServerName)
3. Delete the related web applications
  • Go to Start > All Programs > Administrative Tools > Internet Information Services (IIS) Manager.
  • Expand the node corresponding to your server.
  • Expand the Web Sites node.
  • Delete all web sites corresponding to the MOSS site to be uninstalled.
4. Remove the MOSS installation
  • Open the Control Panel.
  • Click Add or remove Programs.
  • Scroll down to Microsoft Office SharePoint 2007.
  • Click the Remove button and follow the instructions.
I hope you find this guide helpful. Here are the links of two further posts that were very useful to me: Uninstall MOSS 2007 and Uninstalling MOSS 2007 Manually. Comments with corrections or improvements are welcomed :) Samar Hossam

Monday, October 20, 2008

MOSS Administration: How to delete a Shared Service Provider?

A. Deleting an SSP There are two methods for deleting a Shared Service Provider: Method 1: Using the deletessp stsadm operation Syntax stsadm -o deletessp -title SSP Name [-deletedatabases] [-force] Parameters
  • title: Required : The name of the SSP to delete.
  • deletedatabases:Optional: Deletes all databases associated with the SSP.
  • force: Optional: Forces the timer job to complete the deletion of a SSP. To delete the default SSP, you must use the force parameter.
Click here for more details about the deletessp operation. Method 2: Via the browser Type in the URL: http:///_admin/deletessp.aspx?sspId=ID of the SSP B. References for the STSADM operations C. STSADM Tip As I often work with the stsadm tool, I have created a batch file that opens the command console and browses the location of stsadm.exe. Here's the content of the batch file: @ECHO OFF cmd /k cd "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"

MOSS Administration: Introduction to NetBIOS names and FQDNs

Overview I have recently encountered a problem while installing and configuring Microsoft Office SharePoint Server 2007; and while trying to fix this issue I was confronted by the terminologies NetBIOS and FQDN. My limited networking background was sufficient to proceed in the instructions and fix the problem. But still I was interested in exploring the differences between NetBIOS and FQDN. In this article I present a simple overview on that topic, which I quote from a book called Troubleshooting Microsoft Technologies: The Ultimate Administrator's Repair Manual(Chapter 2 Fundamental Networking). NetBIOS Names versus FQDNs An aspect of TCP/IP networking that is essential to understand is the concepts of NetBIOS names and fully qualified domain names (FQDNs). With computers running TCP/IP, it is much easier to remember a friendly name than the IP address of a system. NetBIOS naming and FQDNs both give you the ability to associate a friendly name with a network object, but the primary difference between the two is how you see the name written. An FQDN is typically computer name.domain name.domain extension.(Example: www.awl.com) A NetBIOS name is a simple name used to represent a system but is limited in size to 15 characters. For the FQDN www.awl.com, its NetBIOS name equivalent would be www. Now consider how many www's there are out there. If we used NetBIOS on the Internet, there would be no way to tell systems apart, and that is why the naming convention for any distributed networked environment has to be fully qualified domain names. Naming Rules Now that you understand the fundamental differences between NetBIOS naming and FQDNs, let's look at the naming rules associated with each. NetBIOS naming rules:
  • The name can't begin with a number.
  • The name can be no longer than 15 characters.
  • The name can use the characters A-Z, a-z, 0-9, hyphens; and is not case sensitive.
  • The name can have spaces (a space counts as one character).
FQDN naming rules:
  • The name can begin with a number.
  • The name can be no longer than 255 characters (domain controllers are limited to 155 characters).
  • The name can use the characters A-Z, a-z, hyphens, and is not case sensitive.
  • The names cannot have spaces
  • Portions of the name are separated by periods (e.g www.microsoft.com)
Name Resoltuion Methods So you have seen that we can use NetBIOS names and FQDNs as easier methods to remember computers. While we can remember names, something has to exist on the network to connect a name to its corresponding IP address. These are the predominent methods:
  • Domain Name Service (DNS) - The server that resolves FQDNs to IP addresses.
  • Windows Internet Naming Services (WINS) - The server that resolves NetBIOS names to IP addresses.
  • Hosts file - The file stored locally on every computer that maps IP addreses to FQDNs.
  • LMHosts file - The file stored locally on every computer that maps IP addreses to NetBIOS names.
  • Broadcast - A way for your computer to shout out to the network. "Hey does anyone know computer X?" (Routers drop broadcat packets, so broadcasts only work on the subnet connected to the system sending the broadcast. Aslo, broadcasts gobble up netwrok bandwidth)
Finally, I hope this article has provided a basic understanding of NetBIOS names and FQDNs. For much depth explanations, I recommend referring to the book. Samar Hossam

Monday, October 13, 2008

MOSS Site Template: Working with Site Templates – Part 2

Overview In part 1 of this article, I have introduced Site Templates and explained the various actions performed on them, e.g. save, download, use, delete…etc I have dedicated this article to expose some of the problems I have encountered while working with Site Templates. Problem 1: Custom templates Tab is not visible Description: 1. Add a few custom site templates to the Site Templates Gallery. 2. Open the New SharePoint Site page. 3. In the Select a template section, the Custom tab is not visible. Solution 1: Templates are bound to languages. You can only use a template if you have installed its language Language Pack. After installing the language pack, you will be able to select the language first and then you would see the Custom tab. Click the Custom tab and you will find the custom site templates that you have added. References: http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/6f641f20-7972-4207-87b2-40b7d9554706/ http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/34de88b2-ccdd-40bd-a75c-7c88419046ad/ Solution 2: Site definitions and templates work together to customize a site. Custom templates are always associated with the site definition on which the template is based. A custom template depends on the base site definition in the file system in order to work. You can only use a template if you have installed its base site definition first. After installing the site definition you would see your custom site templates under the Custom tab. Problem 2: Deleting orphaned sites Description: 1. Open the New SharePoint Site page. 2. Select a custom site template from the Custom tab. 3. After you create the Create button, an error message is displayed telling you that the template you have chosen was invalid or could not be found. 4. Click the Go Back To Site link. 5. Click View All Site Content. 6. Under Sites and Workspaces, you can find the new site that has been created with errors. 7. Click the site’s name, you will encounter a page cannot be found error. Solution: An orphaned site is one that is in an undefined state. It exists, but it doesn't exist. Normally the site won't work, but you won't be able to delete it, or overwrite it either. Click here to browse the solution provided by Microsoft. References: http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?List=56f96349%2D3bb6%2D4087%2D94f4%2D7f95ff4ca81f&ID=27 http://blogs.technet.com/corybu/archive/2007/05/31/sharepoint-orphans-explained.aspx Problem 3: Changes in the site template do not affect existing sites Description: 1. Create a site out of a site template. 2. Make changes to the site template. 3. There is confusion about whether the changes will affect the existing sites or not? Answer: You can modify a site template without affecting existing sites created by the template. Problem 4: Access Denied on Custom Workflows Description: 1. Create a custom workflow in SharePoint Designer containing a “Collect Data From User” action. 2. Save the site as a template. Note that the Include content checkbox was selected during the saving of the new site, in order to save the custom workflow. 3. Create a new sub sites based on the created custom site template. 4. Let the custom workflow start and run till it assigns the Collect Data From User task to a certain user. 5. When the user tries to edit the task assigned to him, he gets an access denied error. He also gets a link to request access. 6. Open the Access Request mail sent to the administrator. It contains a link to a page with the following path: Site Name > Workflows > Settings > Permissions. 7. If you add the permissions on this page then user can edit his taks again. Solution: In order to ensure the custom workflow works well after being deployed in another site, you can follow the steps below to grant the permission to the site groups/users. 1. Open SharePoint Designer, and open the site. 2. Right click Workflows and point to Properties. 3. On the Security tab, click "Manage permissions using the browser". 4. It will take you to the Site > Workflows > Settings > Permissions and you can manage the permission in this page. Reference: http://www.tech-archive.net/Archive/SharePoint/microsoft.public.sharepoint.portalserver/2007-10/msg00294.html Well, I hope this helps you troubleshoot your custom site template problems. I would like seize the chance and welcome everyone who would like to share his own experience in troubleshooting site templates. Waiting for your comments! Samar Hossam

Thursday, October 9, 2008

MOSS Site Template: Working with Site Templates – Part 1

A. Overview

When you create a SharePoint site, tailor its components and layout to your need and would like the Site Administrators to reuse your piece of work, then you somehow need to save it as a template.

I was recently working on a project which involved creating and working with custom site templates in Microsoft Office SharePoint Server 2007 (MOSS). I have encountered some problems and have done investigations in various topics which I would like to blog about.

This article is divided into two parts. The first one covers the actions you need to perform when working with Site Templates. The second part is dedicated to troubleshooting errors while working with Site Templates.


B. Site Template vs Site definition

The reason I have become acquainted with site templates is that I developed a team site that contains some custom lists, workflows and list views. I have also edited the web parts on the site’s home page. After I have finished this site, I was concerned about how I can save my work, in order to be reused on other sites without repeating all these steps.

While googling about that topic, I was confronted by two terminologies: Site Template and Site Definition. At first both seemed the same to me or at least both seemed to be able to fix my problem. But there must be a difference. Further googling has guided me to several comparison articles.

Summing up the differences…


  1. Site Templates are easier to create than Site Definitions. All the customizations can be done through the user interface or SharePoint Designer. Creating a site definition requires hand-coding a lot of XML files and other supporting files.
  2. Site templates are also easy to modify. But there is no easy way to modify site definitions once they are deployed. You can only add to the site definition once it is deployed.
  3. Site templates are stored in the configuration database. Templates in the database are compiled and executed every time a page is rendered; therefore site templates can result in slower performance. Site definitions typically perform better when cached on the file system instead of in the database.
  4. Because site templates are stored in the configuration database, the deployment of site templates does not involve server administrators. As for site definitions that require access to the file system, server administrators must always be involved in the deployment of site definitions.
For more details about the differences between site templates and site definitions as well as guidelines about when to choose one over the other, I recommend you to read this article by Dino Dato-on and Jinger Zhao.

C. Save a site template

  1. Open the Site Settings page
  2. Go to the Look and Feel section
  3. Click Save site as template
  4. Type a file name using a .stp extension
  5. Type a name and description for template
  6. Select the Include content checkbox, in case you want to new web sites created from this template to contain the content of all lists and document libraries in this Web site.

NOTE:
If you have developed custom workflows and attached them to certain lists on the site, then you must select the Include content checkbox. This is because the custom workflows are considered as site content.

But what if you want to include the custom workflows in the site content but do not want to include the documents and items contained in the different lists?

Here is a very simple trick to achieve your target:

  1. Perform the described steps for saving a site template
  2. Type stage_temp as the template name
  3. In step 6, you should select the Include content checkbox
  4. Create a new temporary site using stage_temp
  5. Delete all the documents and list items, you do not want to include in your site template
  6. Now repeat the steps for saving this temporary site
  7. Again, select the Include content checkbox. This is for saving the custom workflows
  8. For the sake of cleanup, delete the temporary site as well as the stage_temp site template

D. Download a site template

  1. Go to the root site in the site collection
  2. Open the Site Settings page
  3. Go to the Galleries section
  4. Click Site templates
  5. In the Site Template Gallery, click the name of the template you would like to download
  6. Save the template to the desired destination.
E. Add a site template

There are two ways to add a site template to the template gallery.

Method 1: Using the stsadm tool

  1. Open the command prompt and browse the following directory: Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
  2. Run the command: stsadm -o addtemplate -filename template_file-name -title template_title [-description template_description]
  3. Reset Internet Information Services (IIS) by typing iisreset at the command prompt.
Click here for more details about the addtemplate operation.


Method 2: Uploading the file directly to the Site Template Gallery

  1. Go to the root site in the site collection
  2. Open the Site Settings page
  3. Go to the Galleries section
  4. Click Site templates
  5. In the Site Template Gallery, click the Upload menu and then click Upload document
  6. Browse the template you would like to add and open it.
F. Availability of a template to individual sites

Administrators usually need to manage the availability of a template in the gallery to individual sites. In other words, they set which site templates are available for creating subsites and pages. For instance, an administrator can define that site X can use template 1 but site Y can use only template 2.

To perform this task, follow the steps:

  1. Open the Site Settings page
  2. Go to the Look and Feel section
  3. Click Page Layouts and Site Templates
  4. Select Subsites can only use the following site templates
  5. Select the templates you wish to make available
  6. Click OK
NOTES:

  • You can choose to set the site templates from any site within the site collection not only from the root site.
  • In a site where the Office SharePoint Server Publishing Feature is not enabled, the Page Layouts and Site Templates link is not visible under the Site Settings page. In this case, there is a turnaround for reaching the required page by browsing the following URL directly: http://{siteurl}/_Layouts/AreaTemplateSettings.aspx


G. Use a site template

  1. From the Site Actions drop-down menu, choose Create
  2. Under Web Pages, click Sites And Workspaces
  3. Fill the Title, Description and Web Site Address fields
  4. In the Select a template section, click the Custom tab
  5. You should find your custom site templates under this tab
  6. Select a template
  7. Specify the permissions and navigation options
  8. Click Create

H. Rename the custom tab

When adding custom site templates to your site, these templates land under a so-called Custom tab in the Site Templates List on the Site Creation page. If you would like to change the name of the Custom tab, here are the steps that you should follow:

  1. Open the file Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources\core.en-US.resx
  2. Search for TemplatePickerControl_Custom
  3. Change the content of the value element from Custom to to the new title you would like to display
  4. Reset Internet Information Services (IIS) by typing iisreset at the command prompt.

I. Delete a site template

There are two ways to delete a site template from the template gallery.

Method 1: Using the stsadm tool

  1. Open the command prompt and browse the following directory: Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
  2. List the site templates that have been submitted to the global site template catalog by running the command: stsadm –o enumtemplates [-lcid template_language_locale_ID]. Note that: Enumtemplates only displays the templates that you have installed from the command line for the farm, not the ones stored in a site collection gallery
  3. Run the command: stsadm -o deletetemplate -title template_title [-lcid template_language_locale_ID]
  4. Reset Internet Information Services (IIS) by typing iisreset at the command prompt.
Click here for more details about the enumtemplates operation.
Click here for more details about the deletetemplate operation.


Method 2: Delete the file directly from the Site Template Gallery

  1. Go to the root site in the site collection
  2. Open the Site Settings page
  3. Go to the Galleries section
  4. Click Site templates
  5. In the Site Template Gallery, open the Edit page for the template you would like to delete
  6. Click Delete Item and confirm the deletion.


References

Customizing SharePoint Sites and Portals: Using Templates and Site Definitions, Part 2
http://msdn.microsoft.com/en-us/library/ms916803.aspx

All you ever wanted to know about SharePoint 2007 Site Templates
http://blah.winsmarts.com/2007-7-All_you_ever_wanted_to_know_about_SharePoint_2007_Site_Templates.aspx

SharePoint Server 2007 Templates - it's all in the lingo http://www.mindsharpblogs.com/kathy/archive/2007/04/10/1685.aspx

Addtemplate: Stsadm operation (Office SharePoint Server)
http://technet.microsoft.com/en-us/library/cc261822.aspx

Enumtemplates: Stsadm operation (Office SharePoint Server)
http://technet.microsoft.com/en-us/library/cc263342.aspx

Deletetemplate: Stsadm operation (Office SharePoint Server)
http://technet.microsoft.com/en-us/library/cc263068.aspx

Set Available Site Templates
http://stsadm.blogspot.com/2007/08/set-available-site-templates.html

Rename Template "Custom" tab in SharePoint 2007
http://dirkvandenberghe.com/archive/2008/02/18/rename-template-quot-custom-quot-tab-in-sharepoint-2007.aspx

Restarting IIS (IIS 6.0)
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/003ed2fe-6339-4919-b577-6aa965994a9b.mspx?mfr=true