ConfigLabs

November 16, 2009

Step by step process for changing master page automatically using STSADM command line tool

Recently, my colleague (Ankul Mathur) and me (much of the work done by him!) created a custom solution to change the SharePoint master page automatically on day to day basis.

Requirement: Change the master page based on the day of the week. Example; Monday should have Yellow master page and similarly each day will have its own master page. In a nutshell, the client wants a different looking very day. I know this is usability failure but can’t help!The requirement seems bit weird as we could have done this using CSS alone, but the master page components differ from one master page to the other.  

Ok enough of bantering, lets dive deep into process;

Step 1: Download Gary Lapointe’s Custom Stsadm Command Line tool WSP file for MOSS or WSS from http://stsadm.blogspot.com/2009/02/downloads.html .

Step 2: Follow the steps giving in the article to install and activate the wsp service on the server using Stsadm command line tool.

Step 3: On the server under bin folder in 12 hive run the Stsadm command for setmasterpage to check the Stsadm for setmasterpage is working correctly.

Step 4: Create a Project in VS 2005/2008 named it CustomSTSADM and added a reference for commandlineprocess after download a file from http://www.codeguru.com/csharp/csharp/cs_misc/userinterface/article.php/c8503 . Here is the code;

Project.cs

   1: using System;

   2: using System.Collections.Generic;

   3: using System.Linq;

   4: using System.Text;

   5: using twComps;

   6: 

   7: namespace CustomSTSADM

   8: {

   9:     class Program

  10:     {

  11:         static void Main(string[] args)

  12:         {

  13:             DateTime dt = DateTime.Now;

  14:             string masterPage = string.Empty;

  15: 

  16:             switch (dt.DayOfWeek.ToString().ToLower())

  17:             {

  18:                 case "monday":

  19:                     masterPage = System.Configuration.ConfigurationSettings.AppSettings["masterPageMon"];

  20:                     break;

  21:                 case "tuesday":

  22:                     masterPage = System.Configuration.ConfigurationSettings.AppSettings["masterPageTue"];

  23:                     break;

  24:                 case "wednesday":

  25:                     masterPage = System.Configuration.ConfigurationSettings.AppSettings["masterPageWed"];

  26:                     break;

  27:                 case "thursday":

  28:                     masterPage = System.Configuration.ConfigurationSettings.AppSettings["masterPageThu"];

  29:                     break;

  30:                 default:

  31:                     masterPage = System.Configuration.ConfigurationSettings.AppSettings["masterPageDef"];

  32:                     break;

  33:             }

  34: 

  35:             string masterPageLink = System.Configuration.ConfigurationSettings.AppSettings["masterPageLink"];

  36: 

  37:             CommandLineProcess cmd = new CommandLineProcess();

  38:             cmd.Command = "stsadm";

  39:             cmd.Arguments = string.Format(" -o gl-setmasterpage -url \"{0}\" -sitemaster \"{1}{2}.master\" -systemmaster \"{3}{4}.master\"",

  40:                 System.Configuration.ConfigurationSettings.AppSettings["portalLink"],

  41:                 masterPageLink, masterPage, masterPageLink, masterPage);

  42: 

  43:             bool bSuccess = cmd.Start();

  44:         }

  45:     }

  46: }

App.Config

   1: <?xml version="1.0" encoding="utf-8" ?>

   2: <configuration>

   3:   <appSettings>

   4:     <add key="masterPageMon" value="blue" />

   5:     <add key="masterPageTue" value="green" />

   6:     <add key="masterPageWed" value="yellow" />

   7:     <add key="masterPageThu" value="grey" />

   8:     <add key="masterPageDef" value="pink" />

   9: 

  10:     <add key="masterPageLink" value="/_catalogs/masterpage/"/>

  11:     <add key="portalLink" value="http://server name" />

  12:

  13:   </appSettings>

  14: </configuration>

Step 5: Build the Project. This will create a folder with the project name inside that there will be a Bin folderàRelease folder à CustomSTSADm.exe, CommandLineProcess.dll, and CustomSTSADM.exe.config file.

Step 6: Copy all the above 3 files to bin folder under 12 hive on the server.

Step7: Run the .exe file on Windows Server 2003 and the master page is automatically set to the site set in the .exe.config file. And for Windows server 2008 right click on the .exe file and click on “Run as Administrator” it will set the new master page.

Step 8: Schedule the .exe file in Windows Scheduler to be run on daily/weekly/monthly basis.

On Windows 2008 Server;

Go to Start –> Programs –> Accessories –> System Tools –> Task Scheduler and set the following setting as shown in the images below:  

image

image

As always, if you happen to know a much better way to accomplish this, please feel free to share.

November 10, 2009

Why Social Media Tools are important for Businesses?

Filed under: Social Media — Tags: , , , — Jag @ 1:20 pm

In recent times, Social Media tools (like Facebook, Twitter) are ghastly catching up with other online marketing tools. Not only these tools help people build communities, they also are being used by businesses to connect with their client base. According to Jessie Paul of Economic Times;

Social media is the Wild West of marketing. The revenue models have not yet been worked out and so there is great value for those who understand the medium. Social media provides a fantastic opportunity to connect with your clients. It also represents a significant shift- in the past the website was the primary online presence and all activities were directed around it. Now marketers have to adopt a mall-and-high street approach. For example, much like a mall, aggregators such as YouTube, Facebook, Twitter, LinkedIn specialize in generation of footfall and companies need to be present there to benefit from walk-in traffic. This is in addition to their website which acts like the “company store”.

We at ConfigLabs specialize in providing Social Media Consulting to Small Businesses to ramp up their online marketing strategy. Social Media tools are the new ‘Weapons of PR’!  

November 7, 2009

Overview of SharePoint 2010 in single picture!

Filed under: SharePoint 2010 — Tags: , — Jag @ 1:19 pm

SharePoint2010Overview

September 22, 2009

My Tweets last week

Filed under: Tweets — Tags: — Jag @ 11:47 am

Follow me on Twitter

September 11, 2009

Resources from AUTechEd Talk: Designing for Enterprise Grade Document Management Systems using SharePoint

I attended this great talk on using SharePoint for designing a enterprise wide document management system at recent Microsoft Tech-Ed in Gold Coast, Australia. The Speaker (John Wise) shared huge number of resources with the audience. I think it you gone through this path of implementing DMS using SharePoint, then you might have known the path involved! The resources below should shed some light for us in implementing better SharePoint DMS solutions and/or maintain the existing ones.

More Information about Document Management:

TechNet: Plan document management

TechNet Presentation: Microsoft Office SharePoint Server 2007: Document Management

MSDN: Enterprise Document Management Overview

MSDN: Document Management Overview

Managing the Full Lifecycle of Documents:

ECM Team Blog: Walkthrough – Using the SharePoint Server 2007 Approval Workflow

TechNet Presentation: Designing, Deploying, and Managing Workflow in SharePoint Sites

TechNet: Understanding Workflow

MSDN: Workflow Information Center

MSDN: Workflows in Office SharePoint Server 2007

Increasing IT Manageability and Efficiency:

MSDN: Information Rights Management Overview

MSDN Blog: MOSS Architecture and Shared Services

TechNet: Plan Shared Services Providers

TechNet: Analyze document usage

MSDN: Item-Level Auditing with SharePoint Server 2007

Increased Adoption through Usability:

MSDN: Document Information Panel and Document Properties

Microsoft SharePoint Technologies Blog: Getting Started with Personalization in MOSS 2007 (Audience Targeting)

MSDN: User Profiles and Audience Targeting Overview

TechNet: Plan versioning, content approval, and check-outs

Integrating and Extending Your Document Management Capabilities:

MSDN: Document Information Panel

TechNet Presentation: Content Types and Metadata

Video: Extending the Document and Records Management Features of SharePoint Server 2007

MSDN Blog: InfoPath Forms in Office SharePoint Server 2007

MSDN: What Are Composite Applications?

Interoperability TechCenter

Customizing the Document Information Management Panel

Customizing the Document Information Panel – Presentation

Customizing the Document Information Panel – Script

Program Governance

Governance Resource Center for SharePoint Server 2007

Microsoft Whitepaper – Information Worker Competence Center

Microsoft Australia – Information Management home page

Microsoft Australia – Information Management home page

SharePoint out of the box answers many of the DMS requirements. But when it comes to compliance it take a step back. It is a good idea to checkout the partner solutions to enhance the SharePoint functionality in order to get compliant! The image below summarises different partner solutions for DMS requirements.

image

Links to partner sites

AvePoint

K2

Metalogix

OBS

Quest

SchemaLogic

SeeUnity

Unique World

Note: if you happen to know of any better third party solution for SharePoint DMS please feel free to share!

Building InfoPath forms in Office 2010

Filed under: InfoPath, Microsoft — Tags: — Jag @ 3:43 pm

Here is nice video on how to build forms in InfoPath 2010.

If you learned something new from this, why not checkout more info on InfoPath 2010 @ http://msdn.microsoft.com/en-us/office/aa905434.aspx 

Thank You

September 8, 2009

My Recent Tweets on SharePoint

Filed under: Tweets — Tags: — Jag @ 11:23 am

I am going to post my recent tweets on SharePoint. From now on, I will post my tweets on a weekly basis. That way I can keep up to my promise on ‘one post per week’.

  • Installing the Fourth Release of the Microsoft SharePoint Administration Toolkit http://bit.ly/acBYg on a dev vm.
  • What are the implications of moving just the DB Server from 32 to 64 bit? When the other servers (WFE and IS) are on 32 bit? Any Pointers
  • Be wary of self-described #SharePoint killers http://bit.ly/3AwU7
  • RT @jthake: RT @EUSP: 120 #SharePoint videos under one roof. More coming in daily: http://bit.ly/LjVXi
  • Checking out @Sezai’s #SharePoint documentation tool. http://bit.ly/XmOj6
  • Thanks @Sezai Your SharePoint Farm Documentation tool works a treat! Good Job mate.
  • @bill_correa find the documentation tool here http://bit.ly/XmOj6
  • Current issue of CrossTalk, The Journal of Defense Software Engineering, www.stsc.hill.af.mil. focuses on Resilient Software Survivability
  • Restored all the site collections onto prod and doing some quick tests. All is well till now!
  • RT @jthake: is getting very excited about geeking out with other geeks all next week at #AuTechEd …
  • If u spell #SharePoint as Sharepoint, it is evident that u r not passionate about SharePoint. If u still have trouble come & see me!
  • @joeloleson taking a taxi 1am is not a very good idea unless you have someone local traveling with you. All the best. I’m from Oz
  • Finalising sessions 4 #AUTechEd. I will b concentrating more on SharePoint & Virtualisation. Thats should b enough 2 say where i’m going.
  • Just joined a twibe. Visit http://twibes.com/SharePoint-AuTechEd to join
  • If you are planning to Migrate an existing SharePoint server farm to a 64-bit environment – Read this http://bit.ly/xSSTf
  • How to create a Dynamic Email Subject when using #SharePoint Designer Email Action – http://bit.ly/QjPAy

Follow me on Twitter

Older Posts »

Blog at WordPress.com.