Redirector WebPart SP Solution File Download
So, I am making available to the public the Redirector SharePoint WebPart that I wrote for a buddy who works at a fairly large financial firm (read this post for the complete story on that mess), it’s not very fancy, and the functionality that it introduces into a SharePoint is relatively simple in purpose. I had talked about it before in this post, but only had released the WebPart assembly and not the actual SharePoint solution file which is pretty significant for getting the thing off the ground in your environment.The code itself I will most likely look at optimizing /refactoring at a later date, but for the time being the functionality is there and you can put it to use (as always, I would recommend that you test the WebPart in a staging or development environment before you push it to production). Anyways, it’s free and you can use it at your own discretion, there is no license limit that is placed on it etc. (as with everything distributed on this site), and it is distributed via a SharePoint solution file (.wsp).
To install the WebPart is relatively straightforward, and requires working the SharePoint solution and SharePoint Feature functionality. If desired, a majority of this could just be put into a .bat file. Let’s firstly look at how to deploy the WebPart, and then we can go about examining the business requirement target and why one would possibly use the Redirector WebPart. I think its easier to talk about once you see it actually deployed.
The first thing that you must do is navigate to the directory where STSADM is located. Generally this is in the C: directory.
- C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
Once you see that you can get access to STSADM, you can start to trip the relevant operations. The first thing that you should do is to add the solution file to the SharePoint solution store using the addsolution command.
- stsadm -o addsolution -filename RedirectorWebPart.wsp
Following, execute the timer job. This is necessary if the administrative service is not enabled, as the timer job will be created however it will not be put to work.
- stsadm -o execadmsvcjobs
Now that the solution file is installed, you must deploy the solutions to the relevant web applications. You will notice some interesting switches during this process, mainly that we are deploying it immediately as opposed to scheduling a time (as you see through the SharePoint UI fairly frequently), that we are allowing Code Access Security policies (so that the WebPart can be run from the bin directory as opposed to the GAC which would otherwise post a security risk), and the deployment target is fairly vast.
- stsadm -o deploysolution -name RedirectorWebPart.wsp -immediate -allowCasPolicies -allcontenturls
As before, we are going to force the timer jobs to execute following all at once so are changes take effect immediately.
- stsadm -o execadmsvcjobs
Lastly, we must active the feature that the Redirector WebPart is dependent on. This is accomplished using the activatefeature command. Once the feature has become activated, you will be able to use the WebPart in the relevant site that you wish.
- stsadm -o activatefeature -name RedirectorWebPart -url
Now that you have the WebPart deployed, I guess I should explain what the hell the WebPart does. The business problem that the Redirector WebPart looks to solve is very, very simple in purpose. Often times information workers find transversing a large SharePoint instance difficult, an issue that gets even more complex and convoluted when your MOSS instance becomes an enterprise EIM (Enterprise Information Management) system that becomes an intrinsic part of your and your user’s arbitrary business operations. Generally, one of the most difficult tasks that you encounter when you roll out SharePoint is gathering appropriate end-user adoption of the collaborative technology, since often times finding the information that information workers want tends to be rather difficult since they are not used to the built-in SharePoint facilities. End-user adoption therefore implies meaning getting your users to their information that they want faster and more efficiently. This is a fairly basic principle of all knowledge management centric systems (for more information regarding formal knowledge management theory, you can view some of the research that I have done on the subject here for my course Applicable Knowledge Management in The Workspace at FSU.
Some of it is brief explanations of past research (and researchers) into the subject, however I think that you will find that in concept it will demonstrate the overall architecture of a beneficial KM system and the intrinsic pieces that go into one).
The enterprise search features that are integrated into SharePoint are certainly one method that will get users to where they need to go and closer to the information that the desire in a large environment. However, in environments that instigate multiple site collections, usually the search scopes that are being used vary heavily since it is a site collection by site collection search configuration (which is a PITA). This by no means implies that the search features that SharePoint provides are not a powerful concept that should be exploited in your environment; rather, this is solely a supplement to those concepts albeit a large technology gap.
If there are multiple site collections in the SharePoint architecture / instance, it is common that the site collection holds a specific purpose. Meaning, some architects choose to divvy site collections based on organizational structure and role, such as specifying a site collection for each department, etc. or something similar. This can be any arbitrary purpose; however it tends to follow some sort of naming convention. Although most architects will argue this is not a beneficial architecture for an overall SharePoint strategy, it is relatively common in environments that don’t have the time / resources that need to be dedicated to study pre-existing business processes and tailor the SharePoint instance around those parameters accordingly. Since SharePoint has become an intranet platform for SME (Small to Medium Enterprises) in the Microsoft market they must be taken into consideration.
This is what the Redirector WebPart is assuming that you are doing, but this by no means implies that it requires site collections. You could use it just as effectively with sites. What it does is provide you a limited amount of automatic redirections (10 at the most, if you need more email me), that are based on a SharePoint profile property. For example, you could set the Master Profile Operator to Department (this is actual set as the default in the WebPart class constructor). Then, you could define several profile operators, such as Sales. When a user within their SharePoint profiles have the Department value set to Sales, you can redirect them (if the redirection condition is activated), to http://yoursharepointsite/sites/sales/default.aspx without them seeing the core site collection (you will see this in more detail later).
There are two modes of operations for the WebPart, one for administrators, and another for normal users. Administrators should not be immediately redirected, as they are responsible for maintenance of the root site as well as the configuration and management of the Redirector WebPart. Therefore, administrators are presented with a dashboard of all the current active redirections. Normal users that are not administrators however are instead redirected to whatever conditions are set in the WebPart properties. This is accomplished with a simple method that will trigger the check.
But what if the user doesn’t have anything set for the property in their profile? This is where the default redirection property comes into play. If the profile property returns as NOTFOUND then the user is redirected to whatever you place into the WebPart properties as the default redirection site. It is just a catch all to problems as they may occur.
You can also enable debugging within the WebPart properties. Simple debugging will display miscellaneous information under the WebPart, and if you want to email for help with the WebPart, I am going to ask you to send me this information so enable it first.
You can also manage the appearance of the administrative dashboard directly from the WebPart properties. The label properties (i.e. the string text) that appears throughout the WebPart can be customized to whatever you want, you aren’t limited to those that I have chosen (because I hate when WebParts have hard-coded strings personally, I think the complete appearance should always be manageable by the administrator at the very least, with just immutable methods).
So here is an example use case. I have one account, whose parameters are:
Role: SharePoint Farm / Core Site Collection Administrator
Then I have another John Doe account that works in the Sales department at my organization. Because the sales department generally will only use their specified site collection as opposed to having an interest in the other various business units site collections, it makes sense to just dump the users there.
Username: John Doe
Role : Reader Finance Site Collection
I am making these as just local accounts, as you can see:
I also have two site collections, one is the core site collection, and the other is the sales site collection. Ideally, when the John Doe user first enters the core site collection (since it is the URL that is distributed through all the internal marketing material), they should just be redirected to the sales site collection (or site, whatever your choice is).
As you can see, John Doe is a in the Members group of the sales site collection:
As I am logged in as the administrator, I am not redirected to any site collection, but instead presented with a dashboard view of all the configurations I have made previously. The first thing that I should look into doing is setting up the Global WebPart parameters which will contain things like the root site name (makes it easier to setup the redirections), and if I should have a default redirection instance setup in case none of my redirections are true for users (i.e. returns NOTFOUND).
All my global information is setup, and now I can configure the first redirection condition the WebPart will capture. Since John Doe is in the sales department, I am going to configure my first redirection so that it will look at the SharePoint Profile operator Department for the string Sales. If Department equals Sales then I want the user redirected to the sales site collection located at: /sites/sales/ as you can see in the following site collection creation screen (John Doe is a member of this site collection).
So my Redirection property should look like:
After this property is committed, you will see the Redirection Dashboard adjust so that you see that there is redirection condition that has been enabled. Within the dashboard, you are able to see the profile operator that is being looked up, the property that is being used for comparison, and what site the resulting match will end up with.
Within this condition activated as such, whenever John Doe comes into the friendly core site collection URL, he will be automatically dumped into the sales site collection.
Anyways, once you get to play with it, you will understand how it works. Feel free to email me if you have problems, or if you have suggestions for improvements. I am going to be focusing on my next WebPart project, so I might not be super responsive, but I am always up for improving past freeware WebParts. I will forward to developing more user interaction WebParts that help user adoption, so check back to sharepointsecurity.com and sharepointsecurity.com/blog frequently for updates (or subscribe to my RSS feeds if that is your cup of tea).
Please read this if you want to know the legal policy of ARB Security Solutions Provided Freeware.