Tasks in a (SharePoint Designer) workflow

November 29th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

For a customer I have created a SharePoint Designer workflow that is linked to a Forms Library. The workflow needs to start whenever an item added AND when an item is changed.
One of the steps in the workflow includes assigning a task to someone. This person needs to change a field in the form, after which the workflow needs to start again. However, if you assign a task (or To-do Item as it is called in SharePoint Designer) the workflow waits until the task is marked complete before it consideres the step finished. This means that if the person changes the value in the form and then marks the task complete (the most logical order) the workflow doesn't start again.

A kind of dirty trick to get around this is to add an action to the workflow that assigns a field in the form with it's own value after the To-do item action.

Displaying a file or a folder in the Page Viewer Web Part

November 29th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Today I tried to do something very easy. Or at least I thought it would be. I tried to display a file in with the Page Viewer Web Part.

The first steps are actually really easy:

  • Go to the correct site
  • Select "Edit Page" under the "Site Actions"
  • Click "Add a Web Part" in the section you want the web part to be displayed in
  • Click "Modify Shared Web Part"
  • If you want to display a web page it's very straight forward. Just select "Web Page" and type in a url under link and the url will be displayed.

Unfortunately I didn't want to display a web page, I wanted to display a file. And I was struggling with the way I was supposed to format the path to a file or folder in order to get it to display. Searching on Live or Google didn't get me anything, but eventually I found it:

  • If you want to display a folder or a file you should enter a network path for a folder it would look like file://\pc158 emp, for a file it would be file://\pc158 emp est.txt
  • Displaying a file or a folder will only work in Internet Explorer
  • The file opens either in a separate browser window or inside the Web Part if the application that opens the file supports inline activation for that file in the browser window. 

Some information about the Page Viewer Web Part can be found here:
http://office.microsoft.com/en-us/sharepointserver/HA100240451033.aspx

I haven't seen the browse button that should appear if you select "File" on either of the three environments I tried this on. I'm wondering whether it actually exists, or whether it was supposed to be there and then left out at the last moment..

Setting item level security in an eventhandler

November 11th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Last week I was building a solution for a customer that involved setting item level security on a document in a document library the moment it is added to the document library.
I'm not a big fan of item level security, because it can create chaos from a maintenance perspective, but sometimes it's simply the best, or even the only solution.

I started out be creating the feature that will contain the eventhandler.

The Feature.xml is very straightforward:

<Feature Scope="Web"
    Title="Set Security Eventhandler"
    Id="7B2CB0DC-8F27-4252-A4F2-89729DF9331B"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
        <ElementManifest Location="Elements.xml"/>
    </ElementManifests>
</Feature>

The Elements.xml looks like this:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListTemplateId="101">
        <Receiver>
            <Name>AddedEventHandler</Name>
            <Type>ItemAdded</Type>
            <SequenceNumber>10000</SequenceNumber>
            <Assembly>Macaw.Custom.Moss2007.Portal.Business.Components, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6bdc41c2016ac3e3</Assembly>
            <Class>Macaw.Custom.Moss2007.Portal.Business.Components.SetSecurityEventHandler</Class>
            <Data></Data>
            <Filter></Filter>
        </Receiver>
    </Receivers>
</Elements>

So you can see that I created an eventhandler that will fire when an item is added to the library. By setting the ListTemplateId I'm linking the eventhandler to document libraries. This means that the eventhandler will be linked to every document library on the web where this feature is activated. It would be better to create a feature with your own custom type of document library and link to that, so you can make sure that the eventhandler will only fire when it's supposed to.

Now that the feature is created it's time to move on to the actual code for the eventhandler.

    // First create a new class that inherits from the SPItemEvenReceiver class
    public class SetSecurityEventhandler : SPItemEventReceiver
    {

        // Override the ItemAdded event and add your own code
        public override void ItemAdded(SPItemEventProperties properties)
        {
            SetSecurityForNewItem(properties.ListItem.File, properties.ListItem.ParentList);
        }

        // The function in which I actually set the item level security on the newly added document
        private void SetSecurityForNewItem(SPFile newFile, SPList docLib)
        {
            SPListItem newItem = newFile.Item;
            newItem.BreakRoleInheritance(false);

            SPRoleDefinitionCollection roleDefinitions = docLib.ParentWeb.RoleDefinitions;
            SPRoleAssignmentCollection roleAssignments = newItem.RoleAssignments;

            SPUserCollection users = docLib.ParentWeb.AllUsers;

            try
            {
                SPUser userToAdd = users.GetByEmail(newFile.Properties["MailTo"].ToString());
                SPRoleAssignment roleAssignment = new SPRoleAssignment(userToAdd);
                SPRoleDefinitionBindingCollection roleDefBindings = roleAssignment.RoleDefinitionBindings;
                roleDefBindings.Add(roleDefinitions["Contribute"]);
                roleAssignments.Add(roleAssignment);
            }
            catch (Exception ex)
            {
                ExceptionPublisher.PublishInternalException(ex);
            }
        }
    }

The interesting bit of code can be found in the SetSecurityForNewItem function.

The function starts of by resolving the SPListItem from the SPFile and by breaking the role inheritance on the item. A necessary step to enable item level security on this item. The false means that the security as it is set on the parent document library is not being copied into the item before breaking the inheritance.

Next step is to get the roledefinitions from the parentweb and the roleassignments from the item. The roledefinitions are only assigned to webs, and not to document libraries, lists or items.

Now I need to get the collection of users from the web, these are all the users that are members of the site, or that have browsed to the site. I need this collection of users in order to resolve the user belonging to the email address that is added in one of the properties of the document. The document is a postal item, and the user belonging to the email address is the addressee. To get the address from the document property I use newFile.Properties["MailTo"].ToString(). Using newItem["MailTo"].ToString() would have produced the same result.

Next I add the user to a new roleassignment and get the collection of roledefinitionbindings from the roleassignment, The roledefinitionbindings are used to bind roledefiitions to a roleassignment. Now add a roledefinition (in this case I add the Contribute definition) to the roledefinitionbindings. The last step is to add the new roleassignment to the collection of roleassignments of the document.

Setting security in WSS 3.0 from code is quite complicated. There are roleassignments, roledefinitions and roledefinitionbindings. Roleassignments are used to add users and to link them to sites, webs, libraries or items. Roledefinitions are used to determine the level of security, it can for instance be Read, or Contribute, or you can create your own definition, I'll write another post about that later on. Roledefinitionbindings are used to bind roledefinitions to roleassignments. I must say that I do not completely understand why we can't just bind roledefinitions directly to roleassignments, but we can't, and there is probably an explanation, I just don't know what it is.
I can however very easy change the above code to add the same user with conbribute roledefinitions to the document library instead of the item. The only line that needs to change in order to achieve this is:

            SPRoleAssignmentCollection roleAssignments = docLib.RoleAssignments;

In order to give the user read instead of contribute rights I would use:

                roleDefBindings.Add(roleDefinitions["Read"]);

Basically all you have to do to use the object model to set security in WSS 3.0 is remember the piece of code. You don't need to understand the "why" to build great solution with it..

We've just implemented our first Microsoft RoundTable!

November 9th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Macaw has implemented the Microsoft RoundTable as part of a complete online meeting system based on the Microsoft Unified Communications platform for a customer and has become a RoundTable reseller.

The RoundTable creates a 360-degree, panoramic video of side-by-side images of everyone who is taking part in the meeting and that tracks the person who is speaking and highlights this person's image. If you might want to review a conference later, the RoundTable can also record the complete meeting.
RoundTable works with Office Communications Server 2007 and Office Live Meeting, allowing companies to integrate virtual presentations, shared whiteboards and file sharing into their audio/video conferences.  

For Dutch readers the customer case can be reviewed here and more information about the RoundTable can be found here.

 

Versioning settings on document libraries

September 28th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Yesterday we got a question from a customer whether is was possible to have versioning on a library, and at the same time disabling the check in/ check out option. I didn't know, but after a view minutes of looking around, my colleague Casper found the settings in the document library settings under Versioning Settings.

You can actually configure a couple of interesting settings on this page.

  • Require content approval for submitted items? This is a setting you will especially use on development environments to prevent having to approve every change in for instance a master page or a page layout.
  • Create a version each time you edit a file in this document library? Here you can choose between no versioning at all, just major version and minor and major versions. You can also limit the number of versions to retain.
  • Who should see draft items in this document library? This setting is especially usefull in live environments with sensitive data.
  • Require documents to be checked out before they can be edited? So you can actually turn off the check in/ check out feature. Something I would advice against, because it would bring you back to the SharePoint 2003 functionality where it is possible to work in the same document at the same time with several people and thus when the second person saves his or her changes overwriting the changes the first person made.

Running the Dam-tot-Dam from Amsterdam to Zaandam

September 25th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Last Sunday me and about 30 colleagues ran the dam-tot-dam run. A 16 km run from the dam in Amsterdam to the dam in Zaandam. We've been training for a couple of months, under the guidance of a professional trainer and an enthusiastic runner himself. I've always been running, but I always felt that 10 km was far enough for me. The first time we met Michel he showed a presentation about running and about the dam-tot-dam. I knew then that I would break the 10 km boundary, Brilliant how he was able to motivate the whole group just by talking about it.

After all training for a couple of months the run Sunday was really great. The weather was good, it was sunny and 24ΓΈC (which was even a bit too hot for some people). I was aiming for a time around 1 hour 36 minutes, 6 minutes per km, based on the fact that I can run 10 km in 50 minutes. The atmosphere was great right from the beginning, a lot of people cheering, bands and orchestras playing, it all really made a difference. A special thanks to Linda is in place, who had first run the 4 mile and then cheered the rest of us on at 4 different places along the track. Thanks Linda!

After 1 hour and 32 minutes I completed the 16 km, which I was really pleased with. My race was level, without any big speed differences. In the schema below the overview of my race is shown.

And now on to more 10 kilometers, hopefully sometime next year I will finish one in a time under 50 minutes!

If you're able to read Dutch you can read Lisette's post at the Macaw Corporate blog.

Whitepaper about Microsoft Web Conferencing Choices

September 22nd, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Bart Wessels just posted a blog about a whitepaper that enables you to make a choice between LiveMeeting and Office Communications Server. This is great since it's a choice that several of our customers are actually thinking about this right now.

Brief Description

Compare Microsoft Web Conferencing Choices

Overview

This white paper reviews common business requirements for Web conferencing and describes how Microsoft is helping businesses meet these requirements with two enterprise-class Web conferencing solutions:

  • Microsoft Office Live Meeting
  • Microsoft Office Communications Server 2007

The white paper also provides information to help organizations determine how they can best use either one or both of these Microsoft Web conferencing solutions to meet their requirements.

The whitepaper can be downloaded here.

Microsoft Surface: Wow!

September 22nd, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Yesterday I had a look at the promos about Microsoft Surface, and wow! This is cool stuff.

Here is what they say about it:

Microsoft Surface represents a fundamental change in the way we interact with digital content.
With Surface, we can actually grab data with our hands, and move data between objects with natural gestures and touch.
Surface features a 30-inch tabletop display whose unique abilities allow for several people to work independently or simultaneously. All without using a mouse or a keyboard.

Check it out!

Renaming a MOSS Server

August 6th, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Renaming a MOSS server is meticulous job. If anything goes wrong along the way chances are that you need to reconfigure your whole MOSS environment.

Here are the steps to take, and the order in which to take them if you want to rename a server that has MOSS already installed and configured on it:

*** NOTE: Use only letters, digits and minus for the machine name (so no underscores), max 15 characters.

  • Change each alternate access mapping for your MOSS/WSS deployment in Central Administration:
    • Open Central Administration, "Operations" Tab, "Alternate access mappings" link
    • Modify each mapping item to reflect your newly chosen server name
  • Use stsadm.exe to invoke the "renameserver" command option:
    • Open a command prompt window
    • cd "C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN"
    • stsadm -o renameserver -newservername <newname> -oldservername <oldname>
  • Rename your Server via Change Name Operation in Windows Server 2003:
    • Start Menu | Control Panel | System, "Computer Name" tab, "Change" button.
    • Input your new server name
  • Reboot the server NOW.
  • After reboot, open command prompt
    • cd C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN
    • stsadm -o updatefarmcredentials -userlogin <domainuser> -password <password>
    • iisreset /noforce
  • Check all application pool identities in IIS, update where the old machine name is still there.
  • If you already have a search index drop this, and rebuild it

Your server is now renamed.

Adjusting the top level navigation on all My Sites

May 22nd, 2007 by Mirjam
This blog has moved.  Click here to open this post on my new blog.

Last week when talking to a customer about their new MOSS 2007 environment I was asked whether it was possible to adjust the top level navigation on all My Sites.

In general it is possible to adjust the top level navigation by going to the Site Settings page.
Under Look and Feel you can select Top link bar. Here you can add a new link. Unfortunately doing so in your My Site would mean that you would have to repeat that for every user's My Site.

In order to adjust the top level navigation in all My Sites you should go the Central Administration and to the SharedServices. Here you will find the link Personalization site links under User Profiles and My Sites.
You can add new links here that will be added to the top level navigation between the My Home link and the My Profile link.

You can also target these links, so you could for instance put a link in there that would point to "My Business Unit". This can be realized by adding a link with the title "My Business Unit" for each of the business unit homepages. These links would then be targeted to audiences that are generated for each business unit. This way a user would only see his or her own business unit link displayed in the My Site.

Of course if you work for two separate business units and if you are in more than one business unit audience the link would be displayed twice, pointing to the two different business unit homepages. So it might be smarter to use the name of the business unit as the title for the link. Oh well, this was just an example.. ;-)