Quick and Simple: Make an InfoPath Form Read Only (InfoPath Forms Services in MOSS)

There’s a common business scenario like this:

  • User fills out an InfoPath form.
  • Submits form.
  • Long-running workflow process kicks off.
  • While the workflow is running, we don’t want anyone to change the content of the form.

This office.microsoft.com example describes how to create a separate "view" and mark the whole view as read-only.  This is a workable approach but has the drawback that you’ve effectively created two entire versions of the same form and must now keep them in sync manually.  If you add a field to the editable view, you must then add it to the non-editable view as well.  Over time, with different developers, there can be some divergence. 

This alternative might work better in some cases:

  • Add a new field to the form called "IsEditable".
  • Set its default value to true.
  • Promote it when publishing to MOSS.
  • In the workflow, set the value of IsEditble to false.
  • Go back to the form.
  • Add a rule that "upon open of the form", disable your save button when IsEditable is false.

The drawback to this approach is that all the fields will still be editable on the screen.  The user can get a false impression that they can actually change content.  You can mitigate that by putting in some text that the form is disabled, possibly in big red letters across the top of the page.

In one project, I created a "workflow status" view.  As the workflow progressed, it would update specific status fields that had been promoted from the form.  When the user opened the form, the "open form" rule automatically switched to that view and the user had a nice little summary status.

</end>

Subscribe to my blog.

Use Semaphores in SharePoint Designer Workflow to Prevent Endless Loops

It’s possible to cause an endless loop in a SharePoint Designer workflow.  A common implementation pattern like this causes the problem:

  • Create a workflow and associate with a list.
  • Indicate that it should start on create of new items and update of existing items.
  • A step in the workflow updates a field in "Current Item".
  • Since the current item changed, the workflow starts anew.

To prevent this endless loop, implement a simple semaphore:

  • Add a site column (or column to the list/library if you’re not using content types).
  • Hide it from the edit page (easy to do if a site column via its properties, not as easy if a list column).
  • In the workflow, check to see if the value of the semaphore column is blank.
  • If it is blank, set it to a non-blank value and proceed.
  • If is is not blank, exit immediately.

This can become a fairly nuanced solution, depending on business requirements and so forth, but it’s been a workable pattern when I’ve needed it.

</end>

Technorati Tags:

Subscribe to my blog.

Developers: How Do I Learn SharePoint?

UPDATE: 04/25/08: Was catching up on some blog posts and found a link to this article: http://www.networkworld.com/news/2008/032608-microsoft-sharepoint.html?page=1.  I make note of it because in addition to asking, "how do I learn sharepoint?", some people ask "why should I learn sharepoint?".  That article partly answers the later.

In the last several months, a dozen or more folks from across the planet have been emailing me and asking the general question, "How do I learn SharePoint?"

I’m hardly authoritative, but I’ve had some success (and trying to get better all the time) so I thought I’d document my personal road map.  Others may find it valuable.

Before I do that, I just want to observe that it’s obvious to me, based on these personal emails and the even greater number of MSDN / SharePoint University posts of the same nature, that there is huge developer interest in getting up to speed with WSS/MOSS.  I wonder what it’s going to be like a year from now … easier to find good SharePoint talent?  The same?  Are folks committing themselves to the platform at a rate sufficient to keep up with demand for good resources?  How could you even figure something like that out short of a WAG?

Paul’s Roadmap

I was full time employed by the good folk at Conchango while I followed this road map.  This means that from a learning perspective, I was actively engaged in projects as I followed the steps I outline below. 

Some Basic Terms

For people entering this world, there are two key acronyms:

  • WSS: Windows SharePoint Services
  • MOSS: Microsoft Office SharePoint Server

WSS is "free" in that it’s bundled with windows server 2003 (or at least can be downloaded from MS).  I put quotes around free because you need a box, a valid O/S license and probably SQL (though there’s a "free" kind of SQL as well). 

MOSS is built on top of WSS and extends it.  There is no MOSS without WSS.  MOSS is not free.

Perhaps not day one, but soon after you’ve got some basic familiarity with the platform, it’s important to learn the differences.  For example, a powerful web part, the Content Query Web Part, is a MOSS feature and not available WSS.  People often make the incorrect assumption that CQWP is available in WSS and then end up scrambling for a stop-gap measure when they realize their error.

Hit the Books

I started working with WSS/MOSS on about 01/02/2007.  I had a little prior experience with SPS 2003 but very little.  To get myself started, I purchased the two books listed here (http://paulgalvin.spaces.live.com/lists/cns!1CC1EDB3DAA9B8AA!203/).

I started with the big blue administration book.  Naturally, it covers administration.  At the same time, it provides a survey of all MOSS features (and WSS features as well).

For me, it’s not so important to remember all the various details (until it’s time to get certified) but it’s good to know the boundaries.  (I follow this same approach in 1st person shooters I play on the xbox or PC — I enter a room and tend to make a counter-clockwise loop until I get back where I started.  I just feel better knowing the shape of the box I’m in.)

After reading the big blue book, I would read the entire Inside WSS book.  It dives deeply into issues that developers care most about.

Create a Virtual Environment

In order to do any development or properly use the environment, you need a full blown windows server operating system with SharePoint Designer, Visual Studio 2005 (2008 works, but some useful tools have yet to be ported as of the writing of this article), InfoPath 2007 and some other stuff.  There are many good blog entries describing this process.  I’d have a look at these two:

In addition, Andrew Connell shared his experiences with VMWare here:

Use your favorite search engine to see what other people do.  It’s a useful learning exercise in and of itself.

Spend a few minutes angrily denouncing the fact that you need a server environment on which to do development.  But … don’t bother blogging about it or posting it to MSDN forums.  It’s already been done 🙂.  Instead, embrace it and move on.  You’ll be better off for it.

Get Certified

I believe that the MS SharePoint certification path, which consists four exams, is exhaustive.  I suggest that you follow their online preparation guide and do your best to understand each of the areas of the test.

I do not suggest that you take the exam just to pass it.  I do not suggest that you use one of the "brain dump" style 3rd party "tools" for passing MS tests.  If you can take the test, pass it based on a combination of your own directed study and hands-on experience, you’ll be a stronger developer and job candidate for it.

There are four tests in two "tracks":

Developer:

Admin:

I recommend that developers study for all of these exams.  You’ll be strong for them, though I suppose if you skipped the admin exams, you would get by.

I found the WSS version to be considerably more challenging than the corresponding MOSS versions, much to my surprise.  I was in a class recently and several others made the same point.

While I was studying for the 70-542 exam (MOSS development) I tracked my study resources.  These may be helpful to you as well: http://paulgalvin.spaces.live.com/Blog/cns!1CC1EDB3DAA9B8AA!192.entry

Plug Yourself Into the Community

The SharePoint community is vibrant, strong and growing larger all the time.

You want to look at the following to start:

  • Blogs
  • Forums
  • Codeplex
  • Twitter

Blogs

If you don’t understand RSS, stop everything and learn it.  It will take 10 minutes to learn it, maybe another 10 minutes to find a web based RSS reader (I like google’s reader, www.google.com/reader).

Start by adding this blog to your RSS reader 🙂

Next, add www.sharepointblogs.com to your reader.  They aggregate many blogs into a single feed.

Over time, you’ll find blogs that are not aggregated that way.  Just add them individually.

I subscribe to a few dozen blogs which I’ve accumulate over the last year.  If you want, I can export my list and email it.

Eventually, you may want to start your own blog.  I personally think that a series of blog entries describing a "newbie’s" progress learning WSS/MOSS would be an interesting series. I wish I had done that myself.

Forums

I actively participate in two forum groups: MSDN and SharePoint University.

Forums are excellent places to learn.  People ask questions ranging from the very simple ("How do I create a site column") to the panicked ("My server is down!") to more hypothetical design questions.

Once you get a flavor of the environment, venture out and start replying.  Short of directly interacting with a customer, nothing is better than this for hands on experience.

Codeplex

Go to www.codeplex.com.

Check it out and search for SharePoint projects.

Subscribe to the daily summary Codeplex feed in your feed reader.

Add any new SharePoint projects to your feed reader.

Eventually, after reading the forums and facing down your own WSS/MOSS demons, consider putting together your own codeplex project.

Twitter

As I write this blog entry, a lot of SharePoint folk have started using Twitter

It’s hard to characterize Twitter.  You’ll just have to check it out yourself.

Conclusion

That wraps up my roadmap and makes me current.  I just started using Twitter two weeks ago.

WSS/MOSS is a very cool platform and the community is growing all the time.  Use community resources to improve your skills and enjoy the journey!

</end>

 Subscribe to my blog.

Data Protection Manager: Seems Like a Great SharePoint Backup/Restore Solution

At the New Jersey SharePoint User Group meeting last night, Microsoft Sr. product specialist DuWayne Harrison presented Microsoft Data Protection Manager 2007.  DuWayne was great (and he was supported by one or two colleagues from the audience whose names I don’t recall).  You can get the presentation materials here.

Up until last night, I have never heard of DPM.

I’m not a system admin type person, so I’m writing this from SharePoint consultant’s perspective and may get some of the words wrong.  To me, DPM is a backup/restore solution for Microsoft "stuff":

  • Files
  • SQL
  • O/S
  • Virtual machines (live backup of the VM, even if the VM itself is running Unix).
  • Bare metal recovery (i.e. catastrophic hardware failure).

Beyond that stuff, which I would consider to be minimal requirements for any kind of "real" backup/restore product, DPM also has built-in intelligence for SharePoint.  It understands about server farms and lets you restore:

  • Entire databases (e.g. content, config, etc).
  • Site collections
  • Individual sites
  • Individual items (e.g. documents).

The actual restore process involves extracting the target data from the backup and save it into a "restore farm" and then from there, moving it to the production environment (or wherever you want to restore).  I think this is seamless, but there was a lot of emphasis on the need for a "restore farm".  The restore farm does not need to match the production environment in every particular (mainly in physical topology) but does need to match in terms of templates, versions, etc.

I didn’t see a full end to end demo, but DuWayne did show screen shots and some live demos.  It seems to be as good as it needs to be, at least for a moderate sized environment.

I was particularly struck by the pricing.  Obviously, don’t hold me to this, but I believe that the most expensive pricing is roughly as follows (in USD):

  • $600 for DPM itself.
  • Hardware for a DPM server (and associated stuff for media and all that).
  • $450 for each server you want to back up ("enterprise" license).

A five server farm would cost at most:

  • $600 for DPM
  • $450 x 5 servers = $2,250

Total cost in licenses: $2,850

In practice, it would be less.  You wouldn’t necessarily need to have DPM installed on each web front end, for example.  You don’t necessarily need enterprise licenses either.

The user interface is seems very simple probably would not require any special training to get up to speed.  I did ask about that specifically and there is apparently a 1.5 day class available, though it’s not obvious to me that anyone would really need to take it.

All in all, I think it’s certainly worth investigating if you’re out there looking for a data protection solution for SharePoint.

</end>

Subscribe to my blog.

Technorati Tags:

Twitter: http://twitter.com/pagalvin

Walk-through: Fix Employee Training Template Available Seats Unregister Bug

As many people know, the Employee Training template provided by Microsoft here has a bug that we can reproduce following these steps:

  • Create a class with a max size of 10 students.
  • Register –> Total available seats properly decrements by one.  Result: 9 available seats.
  • Unregister: –> Bug.  Total available seats should increment by one.  It does not.  Result: 9 available seats as per SharePoint, but in fact, there are 10 available seats.

Solution: Use SharePoint Designer to correct the workflow.

First, open up the site.  The folder list for me looks like this:

image

If we have a look at the "Attendee registration" workflow, we see that there is a step labeled "Enforce seating policy".  It looks like this:

image

This step in the workflow updates the item by incrementing the "Filled Seats" metadata column on the course.  If we pull that up in more detail, we see this:

image

That’s all the information we need to fix the unregistration workflow.

If we flip over to the unregistration workflow, there is no similar workflow step.  Add it as follows:

1: Expand "Attendee unregistration" and open up the XOML (see first screen shot if you’re lost).

2: Add a new workflow variable, "New Filled Seats" of type "Number".

3: Assign a value to "New Filled Seats" as shown:

image

4: Decrement the Filled Seats by 1:

image

5: Update the related Course item:

image

6: Make sure all the steps are in the right sequence.  For me, it looks like this:

image

7: Finish the workflow to re-build it.

8: Test.

</end>

 Subscribe to my blog.

Technorati Tags: ,

Random Saturday Morning Observation

I’ve been in classes these past two weeks and one thing that strikes me is that there are a lot of thoughtful, smart people working on SharePoint (as consultants or IT staff) who don’t blog, twitter, seem aware of public message boards like MSDN forum or SharePoint University, maintain Facebook or LinkedIn profiles, etc.  They are pure information consumers.  Not bad, just interesting.

</end>

Technorati Tags:

Subscribe to my blog.

Content Query Web Part: Speaking at New York SharePoint Users Group

I will be speaking with my colleague, Natalya Voskresenskaya, at the New York SharePoint Users Group meeting Wednesday May 7th.

Thanks to Bob Fox for throwing our names into the hat and helping us get this opportunity!

Our overall topic is the Content Query Web Part and we hope to give some useful information to two distinct audiences:

  • Business users (non-developers): Show how CQWP can be configured to solve certain common business problems without any coding.
  • Developers: Show how CQWP can be extended to do some pretty interesting things that a business user wouldn’t normally feel comfortable doing themselves.  This part of the presentation will help business users understand what’s possible using this web part so that they can provide better and more realistic requirements to their developer partners.

Here is the notice NYSPUG mailed out earlier this week:

"Using Content Query Web Part to Solve Business Problems".

MOSS 2007’s Content Query Web Part (CQWP) enables users to create custom views of data queried from many sources, and present that data in one place. Despite its powerful query & content refinement options, CQWP is often an underrated and overlooked feature. CQWP is both a "data extraction engine" (find documents or list items anywhere in a site collection) and also a first-class presentation tool that enables users to control how content is presented by wrapping HTML and styles to format the display nearly any way you wish.

In this demo-heavy session, they will show how to use the CQWP to solve business problems by showing off core features.

  • use default CWQP features, including audience targeting

  • use CWQP as a reporting tool anywhere in a site collection via filter criteria such as "all documents created today".

  • change look & feel of query results to highlight business data, show additional columns of information, display information in a grid format, and others.

  • show how CQWP can aid in content type administration (i.e. find all documents of a particular content type so as to understand potential impact of changing a CT definition).

  • describe some limitations of CQWP

  • provide a list of resources for advanced CQWP techniques, including blogs, ECQWP Codeplex project & MSDN documentation.

</end>

Subscribe to my blog.

Technorati Tags:

FAST SharePoint Integration: Execute a Simple Query

This is a continuation in my FAST coding mini-series for SharePoint folk.  The bit of code below executes a search for the term "test" in FAST via a Console application.  Obviously, it’s a hop, skip and jump away to wrap this logic inside a web part or application page:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using Com.FastSearch.Esp.Search;
using Com.FastSearch.Esp.Search.Http;
using Com.FastSearch.Esp.Search.Navigation;
using Com.FastSearch.Esp.Search.Query;
using Com.FastSearch.Esp.Search.Result;
using Com.FastSearch.Esp.Search.View;
using System.Collections;

namespace Conchango
{
    class InvokeSimpleFASTQuery
    {
        static void Main(string[] args)
        {

            #region Initialize our communication with FAST
            ISearchFactory searchFactory;

            NameValueCollection nameValueCollection = new NameValueCollection();

            nameValueCollection.Add("fastsearchengine", "Com.FastSearch.Esp.Search.Http.HttpSearchFactory");
            nameValueCollection.Add("Com.FastSearch.Esp.Search.Http.QRServers", "fastdemoback:15100");
            nameValueCollection.Add("Com.FastSearch.Esp.Search.Http.RequestMethod", "GET");

            searchFactory = SearchFactory.NewInstance(nameValueCollection);

            #endregion

            #region Launch a query

            string queryString = "test";

            Query query = new Query(queryString);

            query.SetParameter(BaseParameter.CLUSTERING, false);
            query.SetParameter(BaseParameter.NAVIGATION, true);
            query.SetParameter(BaseParameter.NAVIGATION_DEEPHITS, 100);

            ISearchView searchView;
            searchView = searchFactory.GetSearchView("sharepointconn");

            IQueryResult result = searchView.Search(query);

            Console.WriteLine("Total results from search: [" + result.DocCount + "].");

            int docCounter = 0;

            while (docCounter < result.DocCount)
            {

                docCounter++;

                IDocumentSummary thisDocSummary = result.GetDocument(docCounter);

                Console.WriteLine("[" + docCounter + "]: " + thisDocSummary.GetSummaryField("url").StringValue);

            } // while

            Console.ReadLine();
            #endregion

        }
    }
}

It generates the following result:

image

</end>

Subscribe to my blog.

Technorati Tags: ,