Wednesday, April 30, 2008

MOSS Tips

Anonymous Access cannot access List
  • If you are trying to access a list using anonymous access in a MOSS publishing site template, you will be prompted to enter credentials.
  • To solve this, you will need to deactivate a lockdown feature called ViewFormPagesLockDown through stsadm command line.
  • View Solution.

Existing ASP.NET applications

  • If you have an existing ASP.NET applications which you want to integrate with SharePoint. There are a couple of ways you could go about doing it:
    • Custom web part
    • SmartPart which uses ASP.NET user controls
    • Directly add aspx files into Sharepoint
      1. Add Sharepoint master page to your exsiting pages
      2. Deploy the dlls into C:\Inetpub\wwwroot\wss\VirtualDirectories\applicationname\bin
      3. Add dll info to the SafeControls part of the web.config under C:\Inetpub\wwwroot\wss\VirtualDirectories\applicationname\web.config
      4. Change trust level in web.config
      5. In sharepoint designer, drag and drop your aspx page to the location you wanted
      6. Browse your page.
      7. A few limitations:
        • Only work with C#, not working with vb.net
        • Somehow, the onclick event declared on a button in the aspx page could not be recognized, work around using delegate.
      8. For detailed Solution.

Debugging Web Parts

  • If your Sharepoint server is also the development environment, then debug code is simply attaching to the w3wp.exe process.
  • w3wp.exe is the process runs under the NETWORK SERVICE account by default on Windows 2003 and Vista
  • For more details on debugging

Search Web Part

  • If you want to just search for a list in sharepoint and you don't want to create custom web part, you could use a out-of-box form web part to connect to a data view.
  • It is difficult for a custom web part to connect to an out-of-box web part.

Filter List on AllItems.aspx

  • Using FilterField1 and FilterValue1
    • When you are on the AllItems.aspx of a list, if you want to filter the list with certain criteria, you could add FilterField1 and FilterValue1 as query string to filter the list.
    • This is useful, when you want to utilise the url for filter purpose.
    • This wouldn't work with a calculated column which based on other existing columns.
  • Using out-of-box query string filter web part
    • Add the query string filter web part to the AllItems.aspx. Specify the query string name. Connect this web part to the list web part.
    • So now the list can be filtered by the query string.
    • If you want to create a A-Z filter for a list, you could follow this example.

Custom List Form

  • If you don't want the out-of-box add/edit/view pages come with the List, you can create your own custom list form:
    1. Add a new aspx page in Sharepoint designer
    2. Insert SharePoint Controls > Custom List Form
    3. Link the form to a list
    4. Right click the List and go to List Properties > Supporting Files > choose the new file you created to be the default add/edit/view page for the List, make sure you select the Item content type.
    5. More details.

Copy a List

  • If you want to make a copy of an existing list's structure and content as well, you can:
    • Create a list template based on the old List, choose include content
    • Create a new list based on the list template.
    • After you created the new list, if you do a global search, the search result might not return the stuff from the new list since the next round of scheduled crawl is not yet started. In this case, go to shared services and do an incremental crawl on the default site content source. That should fix it.

Sharepoint designer access denied

  • If you encountered an access denied error in Sharepoint designer when trying to edit a page, check to see if the user is a site collection administrator.
  • You cannot open a FBA site from the Sharepoint desinger, just open the windows authentication site which is extended by the FBA site.

Customize Search Core Results Web Part

  • If you want to customize the look and feel of the Search Core Results Web Part, you could do it through XSLT.More details.
  • By editing the properties of the core results web part, you could specify the search scope to search as well.

Office 2003

  • When you have an unhandled exception which close the IE browser, it is more than likely because the Office 2003 you installed on the Server, try Office 2007 will eliminate the issue.

Update scope rule

  • When you add a rule to a scope, you don't need to start crawling of the content source for the search to reflect the rule, just click the 'Start update now' link of the 'Configure Search Settings' page in the SSP.

BDC (1)

Steps:
1. You can download BDC Meta Man from Lighting Tools web site. You can use it to connect to the following data sources:
  • SQL Server
  • Web Service
  • Oracle
  • DB2 - ODBC
  • MS Access
  • MySQL - ODBC
2. Once you connect to the SQL Server, drag and drop the tables you want to create the entities. Drag and drop to create the relationships between those tables.
3. Then generate the definition.xml
4. In definition.xml, under LobSystem node, change the name property to the Application name you gonna use in Business Data Catalog Applications page in Shared Services.
5. Under LobSystemInstance node, add RdbConnection Password and RdbConnection User ID.
6. In shared services, Import application definition.
7. In shared services, Manage Permissions: Business Data Catalog, add users to the list
8. In central admin, under application management, activate Office SharePoint Server Enterprise Web application features
8. In Site Settings > Site Features, activate Office SharePoint Server Enterprise Site features
9. Add a Business Data List web part and Business Data Related List web part. Connect them.

Monday, April 28, 2008

SharePoint Search (1)

Content Source

  • You can create content sources from the following locations:
    • SharePoint sites
    • Websites (non-SharePoint)
    • File shares
    • Exchange public folders
    • Lotus Notes
    • Applications via the Business Data Catalog
Content Index

  • Index is like the table of contents, crawl is the action to establish the index and read the contents for search later.
  • Sharepoint stores content from searching Sharepoint sites in a database. Content from non-Sharepoint sites are stored in the search indexes folder.
  • For SharePoint to search any content, the content must first be indexed.
  • A content index combines details on all the information in the content sources. When users perform searches, the index is queried for content that matches the user-entered terms.

Crawl

  • A crawl is the process by which the SharePoint index is rebuilt or updated to include new information.
  • A crawler starts off with the URL for an initial page. It retrieves the initial page, extracts any URLs in it, and adds them to a queue of URLs to be scanned. Then the crawler gets URLs from the queue and repeats the process.
  • A full crawl is a complete recrawl of all SharePoint content to update the index.
  • An incremental update only reviews items that have changed or been added since the last update.

Crawl Rules

  • If a content source points to www.mycompany.com, and you can use crawl rule to exclude www.mycompany.com/backup, so the backup subdirectory will not be crawled.
  • If you want to include a folder inside the backup folder which is excluded, you can include the url as well, such as www.mycompany.com/backup/folder
  • The above only applies to HTTP content.
  • You can use the asterisk (*) as a wildcard character in crawl rules, for example: http://*.mycompany.com/*.html

Scopes

  • Scopes tell SharePoint what sections of an index to search.
  • A search scope is a subsection of the index based on some predetermined rules related to a specific content source, location, or property.
  • Once you defined the scopes, you can search the content by scopes which narrows down your search to the specific rules you set up.

Scope Rules

  • You define a scope by adding scope rules to the scope.
  • Scope rules define what content to associate with the scope and what content to not associate with it.
  • Each scope rule is based upon a particular scope rule type:
    • Web address (http://server/site)
    • Property Query (Author = John Doe)
    • Content Source
    • All Content

Managed Properties

  • You can create site columns as global properties to define documents and list items. Then you can configure these columns as managed properties so that users can search for documents based on specific content in the Advanced Search interface.

Basic Search Interface

  • If you type two or more keywords in the search box, the result will return a list of items that show where the words appear together and separately, but in no specific order.
  • If you type two or more keywords with quotation marks around the words, the result will return occurrences when the these words appear together and in the order specified.

Keyword

  • A keyword is a word that summarizes the topic for which you are searching.
  • You can define words that are strongly related to your business and identify these as keywords so that when a user types a keyword to perform a search, she receives best bets for the returned results.

Best Bet

  • A best bet is a web address associated with a custom keyword that appears prominently when a user makes a search request using that keyword.
  • Best bet results are returned in the right-hand column of the search results in an order that the administrator specifies.

Reference:

Building Team Solutions with MOSS 2007

Efficient Crawling Through URL Ordering

Defining Crawl Rules and File Types

Plan the end-user search experience

Saturday, April 26, 2008

Site Columns & Content Types (2)

Relationships between Site Columns, content types and List

  • Say we have four site columns that we created:
    • Site Column 1
    • Site Column 2
    • Site Column 3
    • Site Column 4
  • Next we decide 1,2,3 make a logical unit and group it together and created a content type which references those site columns.
  • Next we created a list with a column:
    • List column A
  • Then we customize a list by adding the content type to it, since site columns 1,2,3 are referenced the by the content type, so they are copied to the list.
  • Finally we decide to add the site column 4 to the list.
  • So now the List contains 5 columns:
    • List column A
    • Site Column 1,2,3 (referenced by the content type)
    • Site Column 4
  • Of course, it is possible to simply create a list with no corresponding site columns and content type.

Custom Columns in Lists

  • Easy to create
  • The default choice of most users
  • No reuse
  • Little downside for one-off columns
  • Very problematic if they contain meta data or business rules or configuration information that are likely to change
  • Choice column and calculated column should be considered to be Site Columns

Site Columns and Content Types

  • Reusable
  • Centrally managed
  • Can leverage inheritance
  • Require more knowledge of SharePoint
  • Potentially require more permissions
  • Ideally involve more forethought

Editing Columns and Types

  • Direct Edits to List Columns
    • No cause for concern
  • Site Columns
    • No issues with Display Name
    • Anything else complicates inheritance
  • Alternatively, you can edit Site Columns
    • Always affects all associated content types
    • May affect all list columns copied from the site column
  • Edits to the Content Type
    • May affect all lists based on the type
  • Note: As a result, it is important that you really understand the implications of all this when you are assigning permission to list. And deciding who has the ability to edit the list design. When a list is based on site columns and content types, and a user goes in to the list directly to edit say a formula or choice, they are editing the instance of the column which was copied to the list, not the site column itself. So there is potential versioning problem when we have a list that is based on site columns and content types when users edit the list directly.

Friday, April 25, 2008

Custom Membership

Limits of Anonymous Access
  • No Authenticated Identity
  • No permission levels
  • No web application policy
  • Can add list items, but not documents or attachments
  • Cannot initiate a workflow (if you want to use the workflow engine to put a form on the site for an anonymous user to request some information, out of box, there is no way to do that.)

Filling the gaps in Anonymous Access

  • SharePoint 2007 is based on ASP.NET 2.0
  • ASP.NET 2.0 allows MembershipProviders
  • Global.asax provides events to augment FBA
  • It is possible to handle FormsAuthentication_OnAuthenticate event and log a user in

Steps:

1. Open a new C# Class Library Project in VS2005, name it AnonymousMembershipProvider
2. Add a new cs file called AnonymousMembershipProvider.cs
3. Add using statements: using System.Web; using System.Web.Security;
4. This class needs to inherit from MembershipProvider class
5. Override the ValidateUser method to return true if username is "Anon"
6. Create a method called GetMembers method, set the return type to MembershipUserCollection, add "Anon" to the AnonymousMembershipProvider, and return it.
7. Override the FindUsersByName method, set the totalRecords = 1, return GetMembers();
8. Override the GetAllUsers method, set the totalRecords = 1, return GetMembers();
9. Override the GetUser method, return "Anon" as a new MembershipUser. Same for the GetUser overload method.
10. For all other override methods, just throw new NotSupportedException.
11. Give it a strong name.
12. Go to Visual Studio 2005 Command Prompt, cd your assembly folder. Take a look at the options of by typing gacutil -? Then install the dll into GAC by typing gacutil -i AnonymousMemberShipProvider.dll
13. Use reflector to open AnonymousMemberShipProvider.dll, get the version,culture and PublicKeyToken information.
14. Assume you have already got a anonymous site extended from a default zone. Go to your anonymous site's web.config, add the membership tag, and add the provider in.
15. Go to the default zone's web.config, add the same.
15. Go to central admin, application management, authentication providers, change the anonymous site from windows to forms, uncheck enable anonymous acess, add the provider name, save
16. Go to the anonymous site, you will see a sign in page.
17. Go to the default zone, people and groups, go to site members, add the user, type "Anon" in the user textbox, click ok
18. Go back to the anonymous site, type "Anon" in the user name textbox, no password, sign in, now you can be signed in.
19. Go to the anonymous site's global.asax, add a script, add the FormsAuthentication_OnAuthenticate handler, if "Anon" is validUser, then setAuthCookie, save the file.

Wednesday, April 23, 2008

Site Columns & Content Types (1)

Site Columns

  • After you created and customised the list, if you think ahead a little bit. In a couples of years time, people will make a few dozen lists and they do that by modifying the columns of every single of our lists. They're going to adding columns, take some columns out, change the display names etc. If then you need to do some ETL jobs to pull that data from Sharepoint to an enterprise data store. You look at the data, you will see that a column in one list might be called another name in another list, but they're essentially the same thing. That's where site columns are used to solve this kind of problem.
  • Site columns are for common columns reuse.

Column Types

  • Types available via the Web UI
    • Single line of text
    • Multiple lines of text
    • Choice (menu to choose from, can be rendered as drop down or radio buttons)
    • Number (integer, decimal, double, float, all represented in Sharepoint UI as Number)
    • Currency
    • Date and Time (Date or Time or DateTime)
    • Lookup (information already on this site contained in another list)
    • Yes/No (check box)
    • Person or Group (pulls from user store)
    • Hyperlink or Picture
    • Calculated (calculation based on other columns)
  • SharePoint list do not truly support joins and foreign key relationships. However, the Lookup type allows a column to get its value from another list on the site. If those values get updated, any associated Lookup columns will also be reflected.

Built-in Site Columns

  • Viewable via the Site Column gallery
  • Organized into groups
    • Base
    • Contact and Calendar
    • Document
    • Task and Issue
    • Extended
    • _Hidden (not directly visible to users, not displayed in the gallery)
  • Generally speaking, any column available in a built-in list template have a corresponding site column. Any column that is not displayed in the gallery, either is in the _Hidden group, or in some case, it has a different display name.

Content Types

  • A collection of references to site columns
  • Content types are not only a collection of references to site columns, you can also associate a content type with forms. For example, custom task forms for workflows. Far easier than associate a form with list template.
  • The building blocks of all the built-in lists and libraries
  • When defined by developers
    • Can have custom forms
    • Event handlers
    • Workflows
  • Support a form of inheritance
  • A content type is a collection of references to site columns as opposed to containing a collection of site columns. By using references, WSS enables reuse of site columns across multiple content types and it also ensures that changes to a site column are reflected across all content types.

Build-in Content Types

  • System
    • Item
      • Document
        • XMLDocument
        • Picture
        • ...
      • Event
      • Issue
      • Announcement
      • Link
      • Contact
      • Message
      • Task
        • WorkflowTask
        • AdminTask
      • ...
  • Each node inherits from its parent type, so every type is therefore an item and includes the items type reference to a base site column called title. Picture and XMLDocument both reference all of the site columns used by Document. When defining a new content type, a good practice is to base on the type that the new type most closely resembles.

Lists and Content Types:

  • The following shows a list of the built-in Sharepoint Lists and the content types they use.
  • Document Library - Document
  • Form Library - XMLDocument
  • Wiki Page Library - WikiDocument
  • Picture Library - Picture
  • Announcement - Announcement
  • Contacts - Contact
  • Discussion Board - Discussion
  • Links - Link
  • Calendar - Event
  • Tasks - Task
  • Project Tasks - Task
  • Issue Tracking - Issue
  • Survey - N/A (because every survey is different)
  • Custom List - Item

Tuesday, April 22, 2008

Web Parts

Web Part Fundamentals
  • Interaction and life cycle is controlled by a Web Part Manager
  • SPWebPartManager serializes and deserializes web part instances to content database

Chrome

  • Web parts are rendered with Chrome
    • Title bar
    • Menu
    • Border
  • Rendered by the web part framework
  • Rendered only when web part exists with web part zone. So if you take a web part and put it directly on a page, the chrome is not gonna render.
  • Chrome is responsible for providing common look and feel to all web parts in an application
  • Developers do not need to write code for these visual elements

Simplified Web Part Life Cycle

  • OnInit: control initialization
  • OnLoad: occurs when the control is loaded by the page object
  • CreateChildControls: creates any child controls contained by the control
  • EnsureChildControls: ensures that CreateChildControls is complete. (e.g. if you have code somewhere in the web part which is going to reference a property of a control that is created in the CreateChildControls, depending on when you're doing that, CreateChildControls may not have finished running yet. And EnsureChildControls simply blocks your execution until CreateChildControls is completed. And it guarantees that you're not going to try to reference anything that doesn't exist.)
  • OnPreRender: perform any tasks that are going to change the state of any controls within the web part. (e.g. do binding to a gridview here, don't do it in CreateChildControls, because the viewstate may not be wired up yet and the control may not be in a valid state.)
  • RenderContents: render the contents inside the chrome. Write code here to control the layout of the elements inside the chrome.

ASP.NET Web Parts vs SharePoint Web Parts

  • In general, you should design new Web Parts that inherit from the ASP.NET 2.0 WebPart class.
  • ASP.NET Web Parts have description file names that use the .webpart extension.
  • ASP.NET Web Parts need to override RenderContents method.
  • Windows SharePoint Services 3.0 Web Parts provide backward compatibility with Windows SharePoint Services 2.0.
  • SharePoint Web Parts have description file names that use the .dwp extension.
  • Following is a list of the added features of SharePoint Web Parts.
    • Cross-page connections in SharePoint sites
    • Connections between Web Parts that are outside of a Web Part zone
    • Client-side connections using the Web Part Page Services Component
    • Web Part data caching
    • Asynchronous processing using Web Part work items

Reference:

Micosoft Office SharePoint Server 2007 SDK

Sunday, April 20, 2008

Style Basics

WSS Branding Options:

  • HTML Styles
    • Inline
    • Embedded CSS
    • Style Sheet via HTML Link
    • Style Sheet vis SharePoint:CSSLink
    • Theme
  • Master Pages

MOSS ECM Additions:

  • Page Layout
    • Central part of ECM Publishing Features

Master Pages vs. Styles:

  • Styles
    • Colors
    • Borders
    • Fonts
    • Background Images
    • Hide Elements
    • Positioning and Layout (note: CSS are able to do a lot with regards to positioning and layout and people with experience of CSS when they started to work with Sharepoint tend to using css as opposed to using table. The problem with that is that Sharepoint is composed of so many parts that are not under the direct control of the person who is doing the branding, for example say you've got the layout look right on a page, all of a sudden, some other elements which you have no control over comes in and mess up your layout, attempting to use CSS for layout in SharePoint is a specially frustrating proposition because of the way inheritance works in CSS. The advise here is to use table as opposed to CSS.)
  • Master Pages
    • Provide Structure
    • Full control of layout and default elements including styles

SharePoint CSS

  • Located at 12\TEMPLATE\LAYOUTS\1033\STYLES
  • WSS
    • Core.css - primary style sheet
    • CALENDAR.css
    • datepicker.css
  • MOSS Additions
    • Portal.css - Search center and site directory
    • HtmlEditorCustomStyles.css
    • HtmlEditorTableFormats.css
  • Various others for backward compatibility

How to Affect Styles:

  • Content Editor Web Part (can put style tag on a page)
    • Pros
      • Requires only designer permission access
      • Position on the page means it is never overridden by a cascading style
      • Good for styling a single page
      • Does not require unghosting the page
    • Cons
      • Good for styling a single page, limited reuse
  • Embedded Style in Page (from page opened in SP designer or page created and deployed through Feature)
    • Pros
      • Simple, minimal parts
      • Good for modifying a single page
      • Position on page means it can only be overridden by a Content Editor Web Part
    • Cons
      • Involves unghosting the page when outside feature of site definition
  • Use AlternateCSSLink in ONET.xml (used to specify the css to use in addition to core.css) or HTML link in Master page
    • Pros
      • Affects all non-application pages
      • Provides central control
    • Cons
      • Doesn't affect pages in _Layouts (all the site setting pages do not pick up the css defined here)
      • Stomped by SharePoint:CSSLink for customised pages
  • Theme
    • Pros
      • Applies to all pages including _layouts
      • Centralized control
    • Cons
      • Require features stapling and event receivers to activate automatically on new webs
      • Must be installed on the server
  • Embedded Style in Master Page
    • Pros
      • Affects all non-application pages
      • Provides central control
      • Prevents themes from affecting named styles
    • Cons
      • Doesn't affect pages in _Layouts

Core.css

  • When the page is customized, Sharepoint changes the order the core.css is placed. It will place core.css last in the list when the page is customized.
  • Generally,editing the Core.css is a bad idea. For one it affects everything on the server. And for another, hotfix and service pack can override it at any time.

Picking an Approach:

  • What is the scope of the style changes? (single page or new feature or new site definition)
  • What is your level of privilege on the site and server?
  • Is the desired look and feel configurable by the users via themes?
  • Are you gonna override Sharepoint's style or declaring your own?
  • Should the styles affect the application pages? (If yes, the advice is to use theme)

Saturday, April 19, 2008

Custom Site Definition

Here are the steps to create a custom site definition:

1. Create a Class Library in VS2008, name it CustomSite
2. Since WSPBuilder will be used to create the wsp for this, we need to create the folder structure which is gonna match what WSPBuilder needs to put this into the 12 hive.
3. In the root of Solution Explorer, create a folder structure like the following and use the existing files in the 12 hive as a starting point:

  • 12
    • TEMPLATE
      • 1033
        • XML
          • WEBTEMP.XML (copied from 12\TEMPLATE\1033\XML)
      • IMAGES (add the logo file for this site definition)
      • SiteTemplates
        • CUSTSITE
          • default.aspx (copied from 12\TEMPLATE\SiteTemplates\sts)
          • XML
            • ONET.XML(copied from 12\TEMPLATE\SiteTemplates\sts\xml)
4. Rename WEBTEMP.XML to WEBTEMPCUST.XML, open to edit it.
5. The completed WEBTEMPCUST.XML will look like this:

<?xml version="1.0" encoding="utf-8"?>

<!-- _lcid="1033" _version="12.0.4518" _dal="1" -->

<!-- _LocalBinding -->

<Templates xmlns:ows="Microsoft SharePoint">

<Template Name="CUSTSITE" ID="2008">

<Configuration ID="0"

Title="Custom Site"

Hidden="FALSE"

ImageUrl="/_layouts/images/logo.gif"

Description="A custom site definition."

DisplayCategory="Custom">

</Configuration>

</Template>

</Templates>

6. Now right click the project in VS, go to properties => Build Events => Put the following in the Post-build Event Command Line:

cd $(ProjectDir)
wspbuilder.exe


stsadm -o retractsolution -name CustomSite.wsp -immediate

stsadm -o exeadmsvcjobs

stsadm -o deletesolutioin -name CustomSite.wsp


stsadm -o addsolution -filename CustomSite.wsp

stsadm -o deploysolution -name CustomSite.wsp -immediate

stsadm -o exeadmsvcjobs

7. Go ahead and build the solution.

8. You can take a look at the manifest.xml which is created by the wspbuilder:

<?xml version="1.0" encoding="utf-8"?>

<Solution xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

SolutionId="ddbd4bc7-8a00-4652-9762-0e3998a78746"

xmlns="http://schemas.microsoft.com/sharepoint/">

<SiteDefinitionManifests>

<SiteDefinitionManifest Location="CUSTSITE">

<WebTempFile Location="1033\XML\WEBTEMCUST.XML" />

</SiteDefinitionManifest>

</SiteDefinitionManifests>

<TemplateFiles>

<TemplateFile Location="IMAGES\logo.gif" />

</TemplateFiles>

</Solution>

9. In the above manifest.xml, note that the SiteTemplates tree which contains the ONET.XML is not included in the manfiest.xml. You don't have to include that in the manifest.xml, it just works.

10. Go to Central Administration => Operations => Under Global Configuration => Solution Management => you can see that the customsite.wsp is in the solution list of the farm.

11. Go to Application Management => Under SharePoint Site Management => Create site collection => Under Select a template => you can see the 'Custom' site defintion we've created => click the tab, you can see the 'Custom Site' template as well as the logo and description we've defined in the WEBTEMPCUST.XML

12. Go ahead and create the site collection. Click the link to link to the top-level site. Since we are using the ONET.XML of the team site and we include the default.aspx of the team site, the result is exactly the same as creating a new team site.

13. Go to Site Action => Create => Under Web Pages => Sites and Workspaces => once again the Custom tab will be available under Select a template section, so a site definition can be used to create a top-level site as well as a site within the site collection.

Site Definition vs. Site Template

Site Definition:

1. Requires admin access to server

2. Supports features stapling

3. Files on disk

4. Can provision multiple webs

5. Relatively complex

Site Template:

1. Installable from web UI by site owners

2. Additional features must be activated in gallery

3. Files in DB

4. Single web only

5. Relatively simple

Friday, April 18, 2008

Site Definitions - Part 1

Site Definitions

  • In a very real sense, site definitions are the heart of Sharepoint. A site definition defines a unique type of Sharepoint site.
  • Site Definitions are not Features. They are very similar to Features, schema has a lot of overlap, they're deployed using solution packages just like Features are. But they are not activated the same way and there is no feature.xml for the site definition itself.
  • Core WSS Definitions
    • GLOBAL - A template which is applied before any of the others are applied always. It contains all the common elements for all sites. The core content types, all the fields, and a couple of features as well.
    • STS - Team Site. Team site comes in a couple of flavors, team site itself, blog and blank site template.
    • MPS - Meeting workspaces
    • CENTRALADMIN - Central Admin
    • WIKI - Wiki
    • BLOG - Blog


Site Definitions Files

  • Just like everything else that makes up a Sharepoint site, site definitions are stored in the 12 Hive. In the case of US English being 1033, the files of interest are stored as follows:
    • TEMPLATE\1033\XML
      • WEBTEMP.xml (The rule here is that as long as the xml files in this folder begins with the 'webtemp', then Sharepoint is gonna see that as a web template)
    • TEMPLATE\SiteDefinitions\[site]\XML
      • ONET.xml (stands for Office.NET)

Global Site Definition

  • The Global Site Definition
    • Located at 12\TEMPLATE\Global
    • It is always gonna be created for every single Sharepoint site.
    • It is responsible for laying down the default master pages that are used by team sites.
    • It also creates Galleries. And Galleries are created for:
      • List Templates
      • Site Templates
      • Web Parts
      • Master Pages
      • People and Groups
    • So you can always be assured that on every site that the galleries which contains the above lists will always be present.
  • 12\TEMPLATE\Global folder contains the following files:
    • Lists folder
    • XML folder
      • ONET.XML (This is the definition itself of the global site template)
    • default.master (used in the team sites, if you want to customize a site you can grab the default.master from this folder instead of copy it from the Sharepoint designer)
    • mwsdefault.master (meeting workspace default master file)


ONET.XML

  • Open ONET.XML in the 12\TEMPLATE\Global\XML folder.
  • The first section in ONET.XML is the ListTemplats section.
    • There is a ListTemplate created for each of the following lists:
      • MasterPageGallery
      • sitetemplategalleryList
      • listtemplategalleryList
      • webpartgalleryList
      • userinfo_schema_listtitle
    • ListTemplats is only allowable only in the global site definition. If you want to use ListTemplates in your own site definitions, use Feature.
  • The second section is BaseTypes
    • Content Types
      • Generic List = 0
      • Document Library = 1
      • Disscussion Forum = 3
      • Vote or Survey = 4
      • Issues List = 5
  • The third section is a couples of Features under the Configurations => SiteFeatures node
    • The first one is fields Feature
    • If you open 12\TEMPLATE\FEATURES\fields folder, it contains:
      • feature.xml
      • fieldswss.xml (this is the elements xml), in this file you can see all of the site columns that are defined by default in every single global site, and this is a handy one to use for reference whenever you creating your own content types that are gonna contain fields that are built in to the global site definition, because you will need the field IDs in this xml.
    • The second one is the content type Feature
  • The fourth section is Lists which contains the following lists:
    • MasterPageGallery (Type = 116)
    • sitetemplategalleryList (Type = 111)
    • listtemplategalleryList (Type = 114)
    • webpartgalleryList (Type = 113)
    • userinfo_schema_listtitle (Type = 112)
  • The last section is Modules which defines that it will place default.master File into the master page gallery.

Thursday, April 10, 2008

Solution Development

If you want to deploy a lot of features as a single unit at the same time or you want to deploy something other than features, you are going to step away from feature activation and feature installation and move to solution development.

Required Tools:

  • Visual Studio 2005 and extensions for .net 3 for workflow

  • or Visual Studio 2008

  • Install MOSS SDK which includes WSS 3.0 SDK

  • Microsoft Office SharePoint Designer 2007

  • Version Control

  • SQL Server 2005

Other Tools:

  • Visual Studio Tools for Office

  • Visual Studio Extensions for WSS 3.0 1.1

  • WSPBuilder

  • eLumenotion SharePoint Skinner

  • SharePoint explorer

  • SharePoint spy

  • Application pool manager

Web Solution Packages:

  • The mechanism for robust production deployment

  • Cabinet File

    • Package of files, folders, and assemblies

    • Defined by a Diamond Directive File - DDF

  • Create with makecab.exe

  • WSP extension by convention

  • Contain manifest.xml

Solution Manifest:

  • XML Defines:
    • Files

    • Assemblies

    • Code access security

    • Web parts

    • Features

    • Site Definitions

    • Resources

Solution Schema:

  • Manifest.xml: must be named manifest.xml

  • Specifies destination of each file in WSP

  • FeatureManifests element

    • Feature.xml locations

    • Relative to 12\Template\Features

  • Assemblies element

    • GAC

    • Web Application (bin)

    • SafeControls

  • Resources element

    • Relative to 12\Template\Features

  • CodeAccessSecurity element
    • Policies that determine assembly access rights

  • RootFiles element

    • Relative to 12

  • TemplateFiles element

    • Relative to 12\Template

  • See WSS 3.0 SDK for more

Feature ElementFile Element:

  • Include files in the solution manifest via feature.xml

  • Modular feature

Wednesday, April 2, 2008

Create/Customize List

Say the sales unit of your organisation has asked for functionality in sharepoint to maintain a list for prospects. The customised column required are:

  • Call Back
  • Estimated Revenue
  • Pipeline Stage
  • Forecast Revenue
Create Columns:
1. Go to Site Actions, Create
2. Under Communications, choose Contacts
3. Name the list Prospects, Create
4. In the Prospects list, choose settings, Create Column
5. Name it Call Back, column type is Date and Time, click OK
6. Create another Column, name it Estimated Revenue, column type is currency, check 'require this column contain information', give it min value of zero, Click OK
7. Create column named Pipeline Stage, column type is choice, type Contact, Meeting, Proposal for the choices, check 'require this column contain information', make the default choice Contact, Click OK
8. Create column named Forecast Revenue, column type is calculated.
9. Enter formula: =IF([Pipeline Stage] = "Contact", [Estimated Revenue] * 0.05,IF([Pipeline Stage] = "Meeting", [Estimated Revenue] * 0.25,IF([Pipeline Stage] = "Proposal", [Estimated Revenue] * 0.75)))
10. The data type returned from this formula is Currency, Click OK
11. The syntax for the formula can be found at clicking the help icon on the top right corner of the page, click Business Intelligence, choose Business data in sites, lists, and libraries, choose Formula and functions.

Add Rows to the List:
12. On this contact list you've created, Click New, Item
13. Fill in the forms with contacts' name, and give it a call back date, specify the Estimated Revenue $1000, Pipeline Stage is Contact, Click OK
14. Now you will get a row with forecast revenue column having $50.00
15. Add more rows with different pipeline stage, you will see the results match the formula.

Outlook Integration:
16. Now we test the integration with outlook, choose Actions, Connect to Outlook
17. You can see the contacts you created just now.
18. If you edit the contact in outlook and click Save & Close, go back to the browser, refresh the screen, this will update the contact list in sharepoint.
19. Just note that those customize fields are not available in Outlook.

Calendar View:
20. The sales team can also view this contact list in the form of a calendar, so they can see the call backs that are coming up.
21. On this contact list page, choose Settings, Create View, choose Calendar View
22. Name the view Call Back, set the time interval begin with Call Back column, End with Call Back column
23. Choose the full name as the Month/Week/Day View Title, Week/Day View Sub Heading is Pipeline Stage.
24. Choose the default scope as Week, Click OK
25. Now you've got the calendar of the upcoming call backs.
26. If you want to sync with Outlook calendar, you will need to create the list as a calendar list at the first place rather than a contact list


Tuesday, April 1, 2008

Define managed paths

If you want to create a blog site with an url like http://servername/blog/ in sharepoint, you can either create a site collection as the root site and then you can create the blog site under the root site.

1. Create a new web application under port 80, re-use the port 80 application pool
2. Create site collection for this web application, choose team site template
3. Say the root site is http://myserver/ or http://myserver/default.aspx
4. Choose site actions, create
5. Under web pages, click Sites and Workspaces
6. Give the site title Blog, choose the blog site template
7. So the site url will be http://myserver/blog/default.aspx

Or you can create the blog site as the root site of the site collection.

1. Go to Central Administration, Application Management
2. Under SharePoint Web Application Management, choose Define managed paths
3. Add a Path called blog, choose Explicit inclusion
4. Create site collection, give the site title Blog, choose the blog site template.
5. Make sure the url is http://myserver/blog , click create
6. Now your top level site url is http://myserver/blog/default.aspx

Configuration, Customisation and Solution Development

There are 3 ways that you can look at sharepoint development.

Configuration

  • Creation of web part pages
  • Creation of site collections
  • Creation of lists and libraries via the browser

Customization

  • Branding - Custom themes and master pages
  • Using sharepoint designer to create workflows and modify list forms

Solution Development

  • Custom site and list templates
  • User controls, web parts and application pages
  • Advanced workflows