Wednesday, May 30, 2007

Deploying a calculated site column using a feature in SharePoint 2007

It is not very easy to find a sample of how to define a site column of type calculated using the SharePoint 2007 features framework. The documentations shows how to do it using the user interface (see Calculate data in lists or libraries ). The documentation in the WSS SDK about the  Formula Element in the CAML Core Schemas points in the right direction but is maybe not clear enough. I tested the sample code below by using the site columns in a list definition. You might want to test it out in a content type as well - please provide feedback in the comments.

Code sample feature.xml

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Scope="Site" Title="Calculated Sitecolumn" Id="49C90DCA-6C76-4b30-99DB-7C4C7D100761">
<ElementManifests>
<ElementManifest Location="calcsitecolumn.xml"/>
</ElementManifests>
</Feature>

Code sample calcsitecolumn.xml

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field Name="CalcDemo" StaticName="CalcDemo"  Type="Calculated" DisplayName="Calculated column" ID="{DD01AF0E-5E58-4e50-B3E8-1BFC866CA9A0}" ResultType="DateTime" Format="DateOnly" ReadOnly="TRUE">
<Formula>=StartDate+7</Formula>
<Default></Default>
<FieldRefs>
<FieldRef Name="StartDate" ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}" />
</FieldRefs>
</Field>
</Elements>

Have fun with it ...

 

 

 

Tuesday, May 29, 2007

Compiling SharePoint 2007 audiences using the SharePoint object model (C# code sample)

A while ago I was looking for a way to start audience compilation using code. While I was looking in the SDK I stumbled upon this little phrase which was quite annoying - "Compiling audiences is not supported in the object model. " on
http://msdn2.microsoft.com/en-us/library/microsoft.office.server.audience.audiencemanager.aspx .

Fortunately, it does seem to be possible - here's what you need to do  (I added the code in a SharePoint application page - you know one of those pages that you add in the _layouts folder).

  • First add a reference to Microsoft.Office.Server.Search.dll (which you can find in the ISAPI folder in 12 Hive).
  • Audience compilation can take a while so you might want to show the user one of those new nice "Operation in progress" pages - you can do this using the SPLongOperation class
  • Next add the next code sample in your code behind:

 

SPLongOperation operation = new SPLongOperation(this.Page);
operation.Begin();
SearchContext searchcontext = SearchContext.GetContext(SPControl.GetContextSite(this.Context));

string[] args = new string[4];
args[0] = searchcontext.Name;
args[1] = "1"; //1= start compile, 0=stop
args[2] = "1"; //1=Full, 0=Incremental
args[3] = "Marketing"; //Audience name
Int32 runjob = Microsoft.Office.Server.Audience.AudienceJob.RunAudienceJob(args);

Thread.Sleep(3000);

operation.End(Request.ServerVariables["http_referer"].ToString());

For more information about RunAudienceJob check out the SDK. I left out the code which checks the AudienceJobReturnCode for simplicity sake and you might also want to include some impersonation since the user might not have sufficient rights to run an audience job.


Other resources:




Tuesday, May 22, 2007

Scheduling audience compilation in MOSS 2007 without limits

The default user interface in Microsoft Office SharePoint Server 2007 only allows you to schedule audience compilation once a day but what if you want to do this multiple times a day? Luckily there is a workaround.

Behind the scenes audience compilation uses audiencejob.exe which you find underneath c:\program files\microsoft office servers\12.0\bin\.  To find the correct syntax just type audiencejob.exe this will give you something like

AudienceJob.exe <Application Id> <Command> [Crawl Type] [Audience Name]
Application Id: Guid corresponding to Search application
Command: 1 = Start, 0 = Stop
Crawl Type: 1 = Full, 0 = Incremental (default = 1)
Audience Name: Specific audience to compile (default = all)

Application Id for SharedServices1: be1cf629-000b-4af3-8f6c-dfc3c96563a0

For example:

C:\Program Files\Microsoft Office Servers\12.0\Bin\audiencejob be1cf629-000b-4af3-8f6c-dfc3c96563a0 1 Full all  - will recompile all audiences from scratch.

You can easily use windows scheduler which calls audiencejob.exe to create a scheduled job which runs multiple times a day.

 

Monday, May 21, 2007

Popfly

I just watched the online video demonstrating Popfly - this is really a cool way to build mashups ... So little time and so much cool stuff. If you want to expirement goto www.popfly.com

SharePoint 2007 Tools Collection v1

A while ago - I posted about My Favourite SharePoint 2007 tools ... since then a lot of new cool exciting stuff has come out... So here's an update:

 

  • SharePoint Tips Utility Pack - package of  SharePoint 2007 utilities for administrators and developers.
  • Floating ToolPane for SharePoint 2007
  • SharePoint 2007 RSS Aggregation web part
  • Dan and Teds web part solution package template
  • STP Language converter - SharePoint Site Template Language Converter enables you to convert an  Site Template that was created in one language to another language
  • SharePoint Frantic Redirection webpart - Allows you to redirect users to a specific site depending on a specific user profile property.
  • Microsoft IT Delete Capture 1.0 - http://www.codeplex.com/governance
  • Chatterbox - persistent chat session for SharePoint Server 2007
  • Generic SharePoint 2007 solution installer - allows you to install and deploy SharePoint solution files using a nice UI.
  • SPCAMLViewer - Uses SharePoint webservices to provide inside into the CAML used in SharePoint lists and views . You migth also want to take a look at similar tool CAML Builder.
  • Internet Explorer Developer Toolbar - provides a variety of tools for creating, understanding and troubleshooting web pages.  (Final Release)
  • Fiddler HTTP Debugger - Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler is designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem.
  • Upgrade toolkit for Windows SharePoint Services - Guidance and white papers to upgrade customized site or site template to WSS 3.0
  • BDC MetaMan - Tool to generate Business Data Catalog application definition files for Microsoft Office SharePoint Server.
  • MOSS 2007 utility for import/export of user profiles - allows you to populate your SharePoint Server user profile database using basic XML files as source.
  • Cross-browser editor for SharePoint 2007 (Telerik) - RadEditor for Microsoft Office SharePoint Server 2007 (MOSS) is a cross-browser alternative to the default rich-text editor in MOSS and WSS v3. The product is developed in an agreement between Telerik and Microsoft and is provided free of charge to registered clients of SharePoint 2007.
  • MOSS Query Tool - Next version of the SharePoint Query Tool, designed for MOSS (SharePoint 2007). It has a similar feature set to the SharePoint Query Tool - it allows you to use a point and click interface to gather information such as search scopes and properties, type in search terms, and click a button to create both the search SQL syntax as well as the Xml document that is needed to run a query against MOSS. You can see results in plain text, structured Xml and now a dataset view. It supports FREETEXT and CONTAINS as well as wildcard searching. A very valuable tool for those trying to write custom SharePoint queries.
  • Forms Based Authentication Setup Helper for MOSS 2007 - Utility to ease the process of setting up and configuring Forms Based Authentication for MOSS 2007.
  • Download all documents from document library feature - allows you to generate a zipfile containing all the documents in the list and provides it as a download to you.
  • CAML.Net - Another tool which builds CAML queries dynamically in code while preserving the syntactic structure of the native CAML language. You might also want to take a look at this introducion article - Working with CAML.Net Part I .
  • Site Provisioning Assistant - Public beta - SPA provides you with centralized management for controlling how new SharePoint 2007 sites are requested and provisioned in your organization. Based on provisioning profiles that you define, users are presented with an easy-to-use interface for requesting a new site. Site requests can be associated with custom workflows that match your organization's approval process. Upon succesful workflow completion, SPA automatically provisions the SharePoint site, and notifies the requesting user.
  • SPClientUtilities feature - allows you to switch any SharePoint page into edit mode or show the Web Part toolpane
  • SharePoint Builder on CodePlex
  • SharePoint Inspector - free tool to browse your WSS 3.0 and MOSS 2007 farm. You can see objects composing its structure, get their properties by reflection, which can be very useful when you want to check if your code does what it should do.You can use also some advanced features like activate/deactivate SharePoint features, add/remove event receivers, manage your recycle bin.
  • AppPool recycler for SharePoint Devs
  • SharePoint Features Project at GotdotNet - This project contacts the next features:
    • Presence Contact List v1.0: This is a contact list modified to show presence information as a drop-down associated with the e-mail field
    • Content Type Hierarchy Viewer v1.0 :This Feature presents the site content types in a hierarchical view. It shows the relationships between the content types, including hidden types. The Feature appears as the first link in the "Galleries" section of the Site Settings page.
    • Log Viewer v1.0 : This is a Feature for viewing the Unified Logging Service (ULS) logs through the SharePoint Central Administration site. It adds a new "Utilities" section to the "Operations" tab with a link to the ULS viewer.
    • Debugger feature for SharePoint - When activated, the Debugger Feature adds an “Attach Debugger” menu item to the Site Actions menu.

 

Tuesday, May 15, 2007

Accessibility and MOSS 2007

Mart posted an interesting tidbit where he talks about something that Microsoft Netherlands is working on - a SharePoint template that meets the guidelines set by Dutch government (only in Dutch).

If you need to build a WCAG compliant site, you are in for a whole lot of work - but there are some resources out there which might help you:

Luckily Andrew Woodward already published an overview of how SharePoint Portal Server 2003 and Microsoft Office Server 2007 compare with regards to accessiblity -  Priority 1 (Level A compliance) requirements of the WCAG 1.0 specification. You might probably also want tot take a look at the Technet article about browser support in MOSS 2007. 

SharePoint 2007 How To - Create a custom list definition

The SharePoint SDK shows How to - Create a Custom List Definition but is strange enough not complete. If you follow the SDK sample - the extra field you created in your custom list definition will NOT show up in the SharePoint form pages (Edit item, new item and view item).

In the next posting, I will describe in short the different steps - the last step is the one which I think is missing.

  • Create a new feature as explained in the SharePoint SDK. Afterwards install and activate the feature.
  • Modify the SCHEMA.XML file - Add your custom field inthe Fields section

<Fields>
<Field Type="Choice" Name="FavoriteColor" DisplayName="Favorite Color"

ID="{5F11FE7B-C8D4-4849-A400-133352D17ECF}">
<CHOICES>
<CHOICE>Red</CHOICE>
<CHOICE>Green</CHOICE>
<CHOICE>Blue</CHOICE>
</CHOICES>
</Field>
</Fields>


  • Add a reference to the Field you defined within the ViewFields section


<ViewFields>
  <FieldRef Name="Attachments"></FieldRef>
  <FieldRef Name="LinkTitle"></FieldRef>
  <FieldRef Name="FavoriteColor"></FieldRef>
</ViewFields>



  • Modify the ContentTypes section and modify the Item contenttype to include the custom column. This change will make sure that the custom column will also show up in the edit and new forms.

 


<ContentTypes>
<ContentTypeRef ID="0x0120" />
<ContentType ID="0x0100EE310F92BD4F4ee79829A2FB3A01F1ED" Name="Item"
Group="List Content Types" Description="Create a new list item." Version="2" 
FeatureId="{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}">
<FieldRefs>
<FieldRef ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" />
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE"
               ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<FieldRef ID="{5F11FE7B-C8D4-4849-A400-133352D17ECF}" Name="FavoriteColor"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
<Folder TargetName="Item" />
</ContentType>
</ContentTypes>


  • Finally create a new list using the new custom SharePoint list definition

Friday, May 11, 2007

A SOA is not something that you buy

Another colleague of mine  (allthough he switched to the Dark Side ... just kidding) - finally got his article about Service Oriented Architecture  published in IT Professional magazine ... Here's the online text - De weg naar succesvolle SOA-projecten - Een SOA is niet iets wat je koopt. (Sorry guys, only in Dutch).

 

Technorati tags: ,

Just enough taxonomy

A while ago, I blogged About taxonomy, folksonomy and SharePoint - well here's another nice blog about the same topic - Just enough taxonomy

 

Thursday, May 10, 2007

Microsoft recognizes Dolmen as strategic Information Worker partner

Nice quote  :-)

"Dolmen was one of the very first Microsoft Gold Certified Partners in Belgium that very early invested heavily in acquiring SharePoint related skills. As a result, Dolmen is currently probably the largest competency center for Microsoft Office SharePoint Server 2007 in Belgium and Luxembourg with many satisfied customers.", according to Yves Kerwyn, Solutions Marketing Manager, Collaboration, ECM & Search at Microsoft Belgium.

 

By the way, we are still looking for people wanting to join our Microsoft Competence Center. If you are interested just drop me a line at joris.poelmans@REMOVEMEdolmen.be

 

Excel, OpenXML and PHP

One of my colleagues, Maarten published another article in PHP Architect - this time about his PHPExcel project (available on Codeplex) which uses Microsoft's OpenXML API to create Excel 2007 spreadsheets in PHP. Great article.

I also noticed that Doug Mahugh (Microsoft's Open XML technical evangelist) wrote a piece about PHPExcel.

 

Technorati tags: , , , ,

Wednesday, May 02, 2007

About taxononomy, folksonomy and SharePoint

For those of you who need to design an information architecture - definitely take a look at these articles:

By the way - here is the definition that Wikipedia provides - http://en.wikipedia.org/wiki/Taxonomies

Taxonomy is the practice and science of classification. The word comes from the Greek τάξις, taxis, 'order' + νόμος, nomos, 'law' or 'science'. Taxonomies, which are composed of taxonomic units known as taxa (singular taxon), are frequently hierarchical in structure, commonly displaying parent-child relationships.

Some people might argue that a top-down approach for classifying information is not the way to go - these are probably the ones who prefer to talk about Folksonomies. Here is another Wikipedia definition - http://en.wikipedia.org/wiki/Folksonomy

 

A folksonomy is a user generated taxonomy used to categorize and retrieve web content such as Web pages, photographs and Web links, using open ended labels called tags. Typically, folksonomies are Internet-based, but their use may occur in other contexts. The folksonomic tagging is intended to make a body of information increasingly easy to search, discover, and navigate over time. A well-developed folksonomy is ideally accessible as a shared vocabulary that is both originated by, and familiar to, its primary users. Two widely cited examples of websites using folksonomic tagging are Flickr and del.icio.us, although it has been suggested that Flickr is not a good example of folksonomy.[1]

Those of you working with SharePoint Server 2007 as a solution platform for Knowledge Management and Document Management, definitely take a look at the  taxonomy/tagging starter kit as well as Rapid For SharePoint. One of the things with SharePoint is the fact that it is just to simple to use out of the box - you can dive straight in without thinking.  If you want to make your SharePoint project succeed, make sure that you don't dive straight in but that you plan your information architecture beforehand.

Update: Sven pointed to an interesting article about the advantages and disadvantages of folksonomies

 

BIWUG on Records Management

Last week, we had another BIWUG meeting - I just upload my presentation to the BIWUG website - apparently Inge already uploaded hers:

If you want to immediately dive into the demo - take a look at these postings which I used:

The last part was a demo from Gunter about Business Intelligence on SharePoint Server 2007 - you can rebuild his demo using this blog post - Putting it all together : MOSS 2007 - Business Data Catalog - Search - Excel Services - SQL Analysis Services.

By the way, we are still looking for a topic for next meeting - you can either leave some suggestions in the comments section or add them to the BIWUG site - http://www.biwug.be