IamCalvinBrown.com a Blog Site

Code Examples, Consulting Advice and lots of other cool things

So you have SharePoint, now what…A discussion about adoption


You’ve gone to the seminars, your peers and direct reports have told you how great SharePoint was and how it will change the organization through collaboration. So you have SharePoint, now what. Usage is sporadic among various teams, there are some documents in SharePoint but it is not widely used and the user base ranges from developers who want to use custom web parts to employees that don’t know SharePoint exists. Depending on hardware, licensing, and staff, SharePoint can cost anywhere from $5,000 to $250,000 annually, so how do you get a return on that investment, adoption.

Dictionary.com defines adoption as “to take over as if it were one's own” and that is exactly the approach that department heads and business leaders need to take when looking at SharePoint adoption. SharePoint unlike most application is not what I call a “must-use” application like Microsoft Office. If you want to write a document, you must use Word. If you want to create a spreadsheet, you must use Excel. But when it comes to collaboration especially of content, all you need is a laptop with a “My Documents” folder and email and you are off and running. SharePoint is an “opt-in” application, like any IM application or any business social application (Yammer, Jive, etc.). So the approach must be different “firm but fair”.

So the question becomes how to create an adoption plan, right. Microsoft offers many templates and videos in their SharePoint Adoption Kit that assist organizations to “rah rah” users into using SharePoint. While that approach will work on some users, cheering the application doesn’t answer the biggest adoption roadblocks: “What will it do for me?”, “Is this something else I have to use to do my job?”, and “Do I have to use it?”

To address those concerns here are some simple ways to garner adoption:

Communication

Cardinal Rule #1: Thou shalt not send attachments over email

One of the biggest mistake organizations make is not making SharePoint their central repository of the truth. You are killing your adoption if you have one document stored in SharePoint and have another version of the document in as an email attachment. Instead of attaching, copy and paste the link to the document in SharePoint. That begins to get users in the habit of looking in SharePoint for documents. Habitual behavior is crucial to SharePoint adoption. A study was done and showed that 90% of all computer users open their email program first. They do it although no one told them to through instruction or policy. When asked why, over 70% of the respondents said “it’s a habit”. The same approach must be taken in SharePoint.

Cardinal Rule #2: Thou shalt command from the top down

A former client was looking at how to increase adoption in SharePoint, through many failed attempts once the organization’s CFO started using SharePoint for document reference for preparation of quarterly earnings calls the VP level reports naturally did the same thing. Once the VPs started using SharePoint to report the numbers, the Senior Directors began to use SharePoint to gather the numbers. You get the picture, Senior Executive buy in is crucial but more importantly, buy in must be top down. You don’t have to be a CFO, but if you are managing a team, once you start using SharePoint, the team will as well.

Quick Automation Wins

Cardinal Rule #3 – Thou shalt automate manual processes

More often than not SharePoint is seen as a document repository, missing all of the built-in out of the box automation functionality. If you have any data collection processes (and I bet your HR department has a ton), SharePoint out of the box can very easily automate and streamline those processes to increase usage and adoption, more importantly answer that question “What can it do for me?”. Some very simple out of the box processes that can be automated are:

  • On/offboarding through the use of task lists and alerts
  • Open Enrollment through the use of InfoPath and a forms library
  • Training Registration
  • Expense Reporting

(I told you HR has a lot of processes that could be streamlined)

In conclusion, taking very simple steps will not only increase your adoption but increase the return on your investment and I would be remiss if I did not say that we at King Strategy Solutions  specialize in analyzing your environment and determining the best adoption approach as part of our SharePoint Landscape Assessment.


Joseph King

Senior Sharepoint Collaboration Expert


Why good consultants are rarely available


“Where are you in your career,” a question asked often by recruiters.
 
As an Enterprise consultant, I often find these types of questions, generic and humorous. Seriously! What consultant or consultancy, with a myriad of skills, is randomly available on a Tuesday? If they are, this is a red flag. We are never not working on a project (or 10) and in the bidding process for others. Certainly, some projects are cancelled or budgets are cut, however, we are never idle. At least not the good guys.

According to a poll conducted by CNN Money, there are 5.8 million IT jobs available. With this insight, I have asked several of my colleagues if they have encountered these types of questions. 95% of them say this is a regularly occurring question and they share the same sentiment. I believe the future of solid IT skills will be scheduled in advance, like buying a Tesla or Koenigsegg 1-to-1. I'm left to think and wonder; is the current style of finding good talent antiquated, and in alignment with the "good ole days", where you could bill unlimited fees, travel, and get per diem and expenses approved with only knowing your manager really well? Or, are we looking to update and shift paradigms as quickly as technology itself shifts.


http://money.cnn.com/2015/09/09/news/economy/us-economy-job-openings/

Calling JSONP / JSON WCF Service from HTML


The code below allows you to hit a WCF service and return the results. Use any version of jquery.min.


$.ajax({

                        type: "GET",

                        url: "http://www.iamcalvinbrown.com/wcf/Authentication.svc/sayHello",

                        success: function (j) {

                            console.log('inside results');

                            console.log(j);

                        },

                        error: function (j) {

                            console.log('Error');

                            console.log(j);

                        }

                    });

How to enable CORS in WCF


Familiarize yourself with these items:

1. Global.asax - Application_BeginRequest method
2. Exact url that will be requesting data

Note: http://localhost will not work. Please specify the port (ex: http://localhost:234) if you're running in development mode.

By adding this to your Global.asax, you allow the caller to hit your service and get a return. Otherwise, the status will be a 200, but with a readyState of Load.

HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:61417");
            if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
            {
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST, PUT, DELETE");

                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
                HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
                HttpContext.Current.Response.End();
            }

Creating a Table Variable in SQL



Table variables are excellent for the temporary needs of SQL developers to create a structure (in memory) and select data just as you would from a real table.

Declare @MyTableVar TABLE

(

uniqueRowID   INT IDENTITY(1,1) PRIMARY KEY,

first_name    VARCHAR(35),

last_name   VARCHAR(35)

)

WCF - Return JSON Content (for Angular consumption)


Note: If you use string as a return type, it will not work when consumed directly by Angular.

You need 3 pieces:

  1. WCF Service (ex: RestService.svc)
  2. WCF Interface Class (ex: IRestService.cs)
  3. Newtonsoft.Json (install this package)
What the interface should look like:
public interface IRestService
{
     [OperationContract]
      void getContentInJsonFormat(string id);
}

What the WCF Service looks like:
public class RestService: IRestService
{
     [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle =WebMessageBodyStyle.Bare)]
    public void getContentInJsonFormat(string id)
    {
          string workingString = "some random text or object";  // you should actually put a Json string here or create a class to return

         HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
         HttpContext.Current.Response.Write("[" + JsonConvert.SerializeObject(workingString) + "]");
    }
}

How to call this service:
(when hosted) http://www.IamCalvinBrown.com/restservice/IamCalvinBrown/123
(locally) http://localhost:3242/RestService.svc/IamCalvinBrown/123

The url is unique to your website, so please don't use port 20949 unless it's actually your sites port. RestService is the name of the WCF service. 123 is the input parameter.

Happy coding.

Generate a Random name from an array using JQuery


We have an array of items, and we want to pull the item out of the array by id. In this case, the id is randomly generated. If found, show the name.

1. There should be a div somewhere in the body of the screen named message_div

2. 

<script type="text/javascript">

$( document ).ready(function() {

var array = [ 

{'id':'1' ,'name':'IamCalvinBrown'} , 

{'id':'2' ,'name':'Calvin'}, 

{'id':'3' ,'name':'Nailah'}, 

{'id':'4' ,'name':'Kendi'},

{'id':'5' ,'name':'Everybody'}, 

];


$("#changeTextButton").click(function ()

{

// generate a random number between 1 and 5 (change the 5 to increase with the size of the array)

var _randomNumber = Math.floor((Math.random() * 5) + 1);

// find the specific item in our list

// findById takes the array from above and the randomNumber generated

$("#message_div").html(findById(array,_randomNumber));

});


function findById(source, id) {

 var _id = id.toString(); // conver the number to text since we are generating random numbers

 

 for (var i = 0; i < source.length; i++) {

if (source[i].id === _id) {

 return source[i].name;

}

 }

 throw "Couldn't find object with id: " + id;

}

});

</script>

How to remove special characters from a string in C#


public static string RemoveSpecialCharacters(string str)

        {

            StringBuilder sb = new StringBuilder();

            foreach (char c in str)

            {

                if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_')

                {

                    sb.Append(c);

                }

            }

            return sb.ToString();

        }

Make all urls lowercase in MVC


The line highlighted in yellow sets all urls to lower case. this is more visually appealing to the users and less confusing with longer urls.

public static void RegisterRoutes(RouteCollection routes)

        {

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");


            routes.LowercaseUrls = true;


            routes.MapRoute(

                   "Default",

                   "{action}",

                   new { controller = "Home", action = "Index" }

               );


            routes.MapRoute(

                "Index", // Route name

                "{controller}/{action}/{id}", // URL with parameters

                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults

            );


        }