Wednesday, March 28, 2007
Gantt chart for WSS 3
Labels: sharepoint
Saturday, January 13, 2007
TIP: Sending mail from SharePoint
using Microsoft.SharePoint.Utilities;
SPUtility.SendEmail(SPContext.Current.Web, false, false,
"to-address@mail.com", "E-mail title",
"E-mail body");Labels: sharepoint
Wednesday, January 10, 2007
Sources of the GanttChart web part
Download the sources here.
Oh, and if you create extensions or fixes that would serve not only yourself, it would be really nice if you share them too.
Labels: sharepoint
Tuesday, December 19, 2006
Using Windows SharePoint Services 3.0 as a web site development platform
The approach
We imagined that a simple site would require only the following features:- a custom look & feel, using a custom masterpage and stylesheet
- a document library containing web part pages
- an image library containing the images
- maybe some specific lists for use in the site (News, Events)
Anonymous access and logon style
In our situation, most users of the web site would never log in, but would just browse the site and maybe download some documents. Logging in was only necessary for content managers when adding or changing content. We decided to use Windows authentication for the content managers, but select 'Allow anonymous access' to allow all other users to access the site without logging in. This can be configured through Central Administration under Application Management | Authentication Providers. Obviously, anonymous access must also be enabled on the IIS web site and on the SharePoint site level.Using web part pages for content management
The solution of placing web part pages in a document library and use this as a simple content management environment worked very well. By using versioning, you can have content managers work on pages while anonymous users still only see the last major version (you can set this up through Document Library SettingsVersioning Settings, see image below). You can even have approval required on the library. In our project we did not even use the concept of versioning and have the content managers work directly on the visible pages online. This causes some risk, of course, but in many environments this will meet the requirements and the possible confusion of having multiple versions would not be worth it. For our site, we wanted to have a specific layout of zones in the web part pages. To do this, we created a custom content type, deriving from WebPart Page and a custom version of spcf.aspx. This is the screen where you can specify the name of your web part page and select a template from a list. For our custom type of web part page, we wanted to have only our specially designed zone layout available, including a thumbnail of our site design to go with it. Then we specified that our 'pages' document library could only contain our custom content type and voila: the library would only show our type in the 'New' menu and this would take you to our custom version of spcf.aspx. The only disappointment here was that it turned out impossible to create web part pages from a different file name than the existing spstd1.aspx to spstd8.aspx, so we had to replace one of these with our own.Web Page Metadata
In internet sites, search engine visibility is always important. Most important of course is to be linked to by others, but the metadata in the pages can also help. This includes:- a meaningful URL: this is pretty O.K. using WSS. A typical URL looks like www.sitename.com/pages/ProductSepcifications.aspx
- Keywords and Description meta tags: we created a custom control to include these in the page header based upon a site wide value that could be managed through Site Settings
Menuing
For navigation, our site used the standard structure of a top links menu and a quick links menu. The rendering of these was done with a custom control that rendered more tidy HTML than the standard Microsoft controls did. Maintaining the menu and it's URLs had to be done manually.Drawbacks
Preview
Content managers like to have preview functionality. "Show me the page as visitors will see it". This feature is hard to accommodate. You can open a browser wihout logging in and view the page in this browser to check, but if anonymous users cannot even see the page while it has not been published yet, even this approach will not work.Downloading Office documents
When you offer MS Office documents for download from the site, the Office tools on the client will recognize the SharePoint site as such and will ask the user to login for online editing. Even though the download is perfectly possible without logging in (hit escape), the login box will scare users away. This problem can be resolved mostly by turning off 'Client Integration' for the web application (same screen as allowing anonymous acces, see above). Sadly, even with this feature turned off, some configurations of browser and Office versions will still show the login box. The work-around we found is to remove the OPTIONS verb from the HTTPHandler registration in web.config (yeah, it's a dirty hack).No master page picker or style library
These features are available in MOSS, but not in WSS. Both where implemented by having a WSS Feature called "Design" that included:- Master page
- Stylesheets, images, deployed to a special folder under _layouts
- Default master change on activate/deactivate: activating the feature would set the default master of the site to our custom master page
HTML editor
The HTML editor in both Rich Text fields in lists as in the Content Editor Web Part is very limited. It has no real functionality to clear out garbage HTML resulting from copying Word content and worst of all: you cannot select images from Image libraries or directly upload them. The only option in the "insert image" dialog is to manually enter a URL. For most systems this is really not acceptable. We created a small fix for the Word content, but decided to go live without image integration. Presumably, vendors like Telerik will provider better editors soon. I might even provide one myself some day.Search results uses application.master
The search results page for some reason does not use the default master page of the site, but the application.master. This results in a results page that does not fit in with the rest of the pages. We decided to pull a quick hack here, updating searchresults.aspx to use our custom master instead, but a definite solution here has still to be found.Performance
I have not performed stress tests, but the performance of the product could in my opinion be better. One of the features offered by MOSS is output caching. I am not sure how hard it would be to add such functionality to a WSS site.Conclusion
All in all: when requirements of a web site are fairly simple, WSS 3 is very suitable as a web site platform. It allows to customize the look and feel reasonably well and anonymous access seems to work fine. WSS brings some of the flexibility of the SharePoint platform to the realm of internet presence sites. Add a new field to the list of news items on the home page and sort on this? Content manager can do it! All of the requirements for a full blown content management platform (autorization, versioning, flexible content types, workflows, ...) are built in. Most of them, however, lack a user interface.Labels: sharepoint
Thursday, July 20, 2006
At last: the GanttChart web part with installer and user friendly editor
Oh, one more thing: I also added a new feature: by selecting the Link To Item option, the bars in the chart will be clickable and will link to the detail page of the clicked item.
Labels: sharepoint
Thursday, March 02, 2006
Gantt chart: new version that doesn't overlap other page elements
I just uploaded a new version of the Gantt chart webpart. It contains two fixes.
- No more overlapping. In the previous versions, the chart would hide other screen elements when it grew wider. The new version of the part will claim enough space to show itself and push other screen elements to the side or the bottom (as a proper HTML element should do). If you want to constrain the screen space the chart uses, you can always use the standard web part settings Width and Height from the Appearance tab.
- Allows empty start and end dates. In the old version, the part would not work if one more more records would have an empty field (for start or end date). In this new version, records with an empty start or end date will show up in the chart (with their title), but without a time bar.
The sources and binaries can be downloaded here. Procedures for installation and configuration have not changed.
Labels: sharepoint
Friday, February 10, 2006
Step by step Gantt chart setup
Step 2, we add an instance of the Gantt web part to the page:
Note that the part initially doesn't find a list named "". You must pass it the name of the list it should work with. When you do that it will look like this (check out the message in the web part):
Note that the View field is still empty, but the error message is about a missing start date. The part automatically uses the default view (in this case 'All Tasks'), which does not include the Start Date. So we add it to the view (step 3):
Now, when you enter the right values for the web part (step 4), it will work like a charm:
Now let's do an extra thingy: we create a new view for the list, showing the 'Created By' and 'Created' fields and grouping by the status field:
I added the status field to the list as well. The Group By field must be included in the rendered fields. This may seem odd, but the part needs it. I may fix this requirement, but not right now.
Labels: sharepoint
Wednesday, February 01, 2006
New version of Gantt part: Group By and Year/Month/Week views
- Group by: if your underlying view uses groupings, the Gantt chart will show these groupings as black grouping containers. The start and end date of the grouping will automatically stretch to reflect start- and enddates of underlying items
- Other time partitionings: several people requested a week or year view. You can now choose between a MonthDay view (where the top bar shows the months and the second row the separate days), a MonthWeek view showing weeknumbers on the second row and a YearMonth view that shows years in the top row and months in the second. This will work better for longer time frames.
Shots
This is the classic month/day view, but now using groupings:
This is the new month/week view. Keep in mind that week numbers are fairly complex stuff and that the outcome depends on the local culture settings of your server. My development server uses Dutch settings and therefore the week numbers in this image reflect ISO week numbering:
And finally the year/month view:
Apart from the really new features, I also added some more robust error handling, preventing the web part to crash when a wrong or misspelled view name is entered. I hope that this will make the part more usable.
Download and Installing
Download the binaries and sources here. Then install the part on your server using the contained dll and dwp files.
Check out this manual for how to install a web part when you have no installer, but only the dll and dwp files.
When configuring the web part, you'll have to manually enter the list name, view name, start date field, end date field, title field and finally the Timebar mode (valid values are YearMonth, MonthWeek and MonthDay).
Labels: sharepoint
How to manually install a SharePoint web part when you have only the DLL and DWP files
When I posted my Gantt chart web part, some people asked for more guidance on how to deploy web parts that don't come with an installer. In my opinion, a professional web part should come with an installer, but sometimes people post samples or demos and don't have the time (or motivation) to build an installer for you and you are stuck with a DLL file and a DWP file. This post describes how you get it to work.
Prerequisites
- You must be administrator on the server running Windows SharePoint Services (WSS)
- You must have a working version of WSS running, obviously
Placing the files in the right folders
You will have downloaded a ZIP file containing at the very least a DLL file and a DWP file. These two files are the bare necessities for installing your web part. In a default WSS installation, you will have a folder C:\Inetpub\wwwroot\wpcatalog. Place the DWP file in this folder. Place the accompanying DLL file in the C:\Inetpub\wwwroot\bin folder.
The new web part will now appear in the catalog when you browse for new web parts, but you have to change some settings before you actually use it.Trusting the part
By default, SharePoint will distrust all DLLs that are placed in its folders. We have to tell SharePoint that our specific web part can be trusted. To achieve this, you open the web.config file in the C:\Inetpub\wwwroot folder. This is an XML file and you must be very careful editing it: when your edit results in invalid XML, the whole WSS system will stop working (if you have no idea what invalid XML is, this post is not for you). Also: every time you save the web.config file, the web server will restart itself (the AppDomain, really). Don't do this casually on a production system. Remember to make a backup of the old web.config. In the XML file, you will find a section <safecontrols> that contains a list of trustworthy web parts. Normally, the web part author will provide you with a snippet that should be added to the list.
Once the web.config is updated, your web part should be ready to roll. Some web parts may need additional steps, but these will then be described in detail by the part's author.
Labels: sharepoint
Tuesday, January 10, 2006
A web part for rendering Gantt charts
I promised a month ago that I would post a web part for charting WSS data into a Gantt chart. Well, here it is. It looks somewhat like this:
The part allows you to specify a list and view to render. You select the fields from the view that will indicate the start and end date of an item. The third required field is the title field. Because the part works with view fields, you can also use calculated fields to specify the start date, end date or title of the item.
Because I was too lazy to create a custom designer, you have to enter the names of the list, view and fields in a textbox. When you specify incorrect values, the part will show you the available options in it's error message.
So you want to use it? I put up a zip file containing both the sources and binaries. I haven't made an installer, but I suppose that most of you know what to do with a dll and dwp file (otherwise, check here). In your web.config you'll have to add a line for trusting the part like this:
The web part is actually more of a sample of using the underlying GanttCharting library. This will render VML that can be directly included into the HTML (IE only!). The charting library has some features that are not used by the web part, but that you may want to build on:
- aggregation: each GanttItem can have a collection of sub-items. Items with sub-items will be rendered accordingly (see sample in this post)
- links: each item has a LinkUrl property that will be placed on the item. You could have the item link to the edit page of the item
- color: you can color each item as you wish
Labels: sharepoint




