Monday
Dec162013

Resource for SharePoint farm upgrade with server name change

This was a question I had someone ask last week regarding how you might handle the situation where you want to change the host name of your SharePoint farm in an upgrade (or just the host name for any web app really) knowing that all embedded links will be broken.

 

The low hanging fruit is to set a DNS record so that the old and new point to your new server address, but if you want to alter some site names and/or alert users that they have an old, deprecated url instead of just forwarding them on, the solution below might work for you.

 

The following script is for the node.js platform and, if run on a server with your old host name's resolution, will intercept incoming http requests, map it to your new server, allowing for site renaming and provide the user with a message as well as the new 'best guess' url to what they were trying to reach.  It is pretty straightforward and should be relatively easy to modify as needed.

 

HTTPS (443): This is geared toward standard HTTP traffic, if you need a version to work with HTTPS on port 443, you can find some subtle changes that will be needed in the node.js information here http://nodejs.org/api/https.html.

 

// Kevin Guyer - 2013
// Node.js script to handle server (SharePoint) name changes
//  This is designed to catch the use of old urls and present an infomational page with the new url to the resource
//  Test with this to see URL altering:  http://localhost:8080/hr/foosite/barsite/somelibrary/somedoc.pdf

// Intercept incoming port 80 or 443 (needs to operate on both) - set the port below for flavor you are running
var http = require('http');
var url = require("url");
var server = http.createServer();

server.on('request', function(request, response) {
	var hostname = request.headers.host;
    var newHostname = 'https://yournewfarmpath';  // no trailing slash, set to your new farm/server name and path
    var pathname = url.parse(request.url).pathname;
    var newPathname = pathname;
    var query = url.parse(request.url).query;  // optional, not used yet
	
    // Run match logic on array elements to determine what needs to be displayed
    var aResPath = pathname.split('/');
    
    // Modify path elements as needed with element matching:
    var wasAltered = false;
	if(aResPath.length >=1){
		try{
			if(aResPath[1].toLowerCase() == 'hr'){ aResPath[1] = 'HumanResources'; wasAltered = true; }
			if(aResPath[3].toLowerCase() == 'barsite'){ aResPath[3] = 'NewBarSite'; wasAltered = true; }
			// add others as needed, sites on root starting at index [1]...
		} 
		catch(err) {
			// handle as desired...
		}
		
		if(wasAltered == true){
			console.log("Detected swap string in path, altering output.");
			newPathname = '';
			for(i = 1; i < aResPath.length; i++){
				newPathname = newPathname + '/' + aResPath[i];
			}
		}
	}
    // Build response message
    var payload = '<h2>Oops.</h2><p>The url you attempted to reach (<em>' + hostname +  pathname + '</em>) is no longer valid.</p>';
    // Optional: Build and supply a best bet url    
    payload += '<p>Our best guess for the new url for this resource is <a href="'+ newHostname + newPathname+'">'+ newHostname + newPathname+'</a>.</p>';
    payload += '<p>Please update your favorite or link source to reflect this new address.</p>';

    // Optional step to log the old url hit via a web API (REST) - todo...

    // Build and deliver response    
    response.writeHead(200, {"Content-Type": "text/html"});
    response.write(payload);
    response.end();
});

var port = 8080;  // change this to 80 or 443 as needed
server.listen(port);
server.once('listening', function() {
    console.log('Redirect server is now listening on port %d', port);
});
Monday
Jun242013

Banner with Quick Access to Search a SP2010 List

This is a quick piece of script and HTML that I threw together to help make it easier for our users to search a list or library in SharePoint when they were on a view page. Once added to your environment you can add this to the top of any view and it will both display the name of the list in the banner and dynamically set itself up to search the list/library that the hosting view lives on.

There is a search control included in SharePoint but this saved a few steps (clicks) we thought might be critical in getting people to use search more often and it makes for a nice custom banner to boot. With a little tweaking you can further change the banner text, the control's watermark and the banner image. With a few small changes this could also have the scope set to the site instead of a list.

All of the code, images and documentation for deployment is in the accompanying .zip file. Let me know in the comments if you have further suggestions.

DOWNLOAD SEARCH BANNER

//Kevin

Wednesday
Apr032013

Metro-Style Easy Tabs for SharePoint 2010

This is an item I flashed a development iteration of to the group in my Richmond SharePoint Saturday presentation and have since cooked up what is called 'V2' of the effort but is really the first version that I've made available. This approach just simplifies the initial version by making the tile's images all the same, though I did add a dynamic element to the colors. I'm not yet sure if that is a good idea, so I have instructions below to turn that off if you'd like. This is all based on the brilliant client-side Easy Tabs script that I just modified and simplified for the new visual style.

You can deploy these as you would 'normal' Easy Tabs for SP, my instructions for using the original script are here though you'll want the new code as it is not in that package:

Want to kill the random tile colors? Yeah, can't say I blame you...

Edit line #108 in the file from this:

var colorNumber = 1 + Math.floor(Math.random() * 9); // random start 1-9

to this (where the '1' can be any number from 1 to 9) :

var colorNumber = 1;


I may make more versions of this, including one allowing for a single color for the tiles.  Let me know if there is a feature that you might like that I should consider.  I'm not sure yet how to reliably incorporate custom images per tab (that make sense to the tab's context) without the end user editing the script and violating the plug and play goal here.

This version looks like the above screenshot with both a hover effect and a visualization for selected items.  Over-n-out.

Saturday
Mar232013

The Cheapskate's Guide: Extending SP 2010 Functionality

This is what I am presenting at SharePoint Saturday in Richmond VA and the accompanying file packages that go with that talk. There are 13 items total, each of them containing any scripts and resources needed (that I can provide) and a PDF breakdown of what it takes to deploy them. 5 of the 13 use Javascript controls I picked up for cheap from Codecanyon.net, you'll need to grab the control mentioned to get these to work, the others contain all that you need to get running. Drop me a line if you do something cool with one of these or modify them.

 


The Slides:

The Controls:

  1. Calendar Viewer (free)
  2. Foobar Alerts - $2 Coffees (foobar 2.1)
  3. Tabs – Original (free)
  4. Tabs – Metro (free) (Edit:Published here!)
  5. News Page Rotator - $4 Coffees (Royal Slider 9.4.8)
  6. FAQ (free)
  7. Tabbed Container - $4 Coffees (Zozo Tabs v2.2)
  8. I Want To (free)
  9. Image Rotator - $3 Coffees (jQuery Banner Rotator)
  10. Google RSS Static (free)
  11. Google RSS Scrolling (free)
  12. Snow - $1 Coffee (JSized Snow Effect)
  13. Google maps traffic widget (free)

Other links of note:

Monday
Mar112013

Outlook-Fu: How to 'Snooze' Email in Your Inbox

If you are like most people today (including me), your inbox doubles as your to-do list and is the roadmap for what you need to take care of each day. We know that it is not ideal, but is what the majority of us use, because it is there and contains our action items already. Below are instructions for setting up a way to 'snooze' email messages so, much like you do with appointments that pop up in the Outlook reminder, you can hide them from view until they need attention. I find that the lack of clutter created by things I don't need to address yet keeps my inbox streamlined and easier to manage.

To do this we'll be creating a new view of our inbox and setting a filter. Instructions and screenshots are shown in Outlook 2013 but the same options discussed are available with Outlook 2010 as well.

Step 1 – Create a new view

  1. Navigate to your inbox
  2. In your 'view' tab, under 'Change View', choose 'Save Current View as New View', give this view a name and allow it to be used on All Mail and Post folders
  3. Now you have a duplicate view and can hop back between this and your original view at will via the 'View' -> 'Change View' option.

Step 2 – Configure a Filter

We want the new view to only show items that both have no Due Date (otherwise we don't see any new items) and those that have a due date of today or before. To do this you:
  1. Open 'View Settings' in your View menu
  2. In the Advanced View Settings dialog, choose 'Filter'
  3. In the 'Advanced' tab, add an item for 'Due Date', you'll find that under 'Frequently-used Items' and set it's condition to 'does not exist'. Then add this rule to the list.
  4. Repeat the previous step, adding another Due Date filter but with the condition of 'on or before' and in the 'Value' field type Today and add the rule to the list. You will have the following 2 rules showing now. Click OK both here and in the Advanced View Settings to return to your new view. You are done.

Using your new View and Powers of Snooze

Now, when you right-click the flag icon beside a message in your inbox you are shown the due date flag options that look like this:

When you open these flag options for a message and set the due date flag to one of the dates in the future, say tomorrow, it will now disappear from the view of your inbox until tomorrow. Out of sight, out of mind. Note that setting an item to 'This Week' will set the reappear/due date to the upcoming Friday and 'Next Week' will set it to the following Monday. You can choose 'Custom' to set any specific date you want to have it reappear as well, even telling Outlook to throw a reminder if you like.

Items that you set to a future date will now hide until you want them to reappear, though you can always shift to your original view (which is why we made a copy of that view to begin with) in order to see all items in case you need to get to a message before it's due date.