Getting the logged on user name using the client object model

If you want to use the SharePoint 2010 client object model you can use the code below:

ExecuteOrDelayUntilScriptLoaded(getWebUserData, “sp.js“);
    var context = null;
    var web = null;
    var currentUser = null; 

        function getWebUserData() { 
        context = new SP.ClientContext.get_current();
        web = context.get_web();
        currentUser = web.get_currentUser();
        currentUser.retrieve();
        context.load(web);
        context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), 
             Function.createDelegate(this, this.onFailureMethod));
   }

    function onSuccessMethod(sender, args) {
        var userObject = web.get_currentUser();
        var UserTitle = userObject.get_title();
        alert(UserTitle);
        }

    function onFailureMethod(sender, args) {
        alert(‘request failed ‘);
    }


Here is a video and a simple way to test it.

If you want to save some time by not having to open SharePoint Designer 2010, you run this code directly from Chrome using the web developer tool. The video below shows you how to do that.

Validating a SharePoint form field in SharePoint Designer 2010

The video demonstrate validating a textbox using the PreSaveAction() in SharePoint Designer 2010.   If the textbox is blank you will receive an alert.

How do I: Create a simple form to collect data in SharePoint 2010
How can I hide/show a textbox based on a radio button selection?
How can I hide/show a textbox based on a drop-down value?

Hiding and showing fields using jQuery in SharePoint Designer 2010

Building forms using SharePoint Designer can be a bit tricky at times. What if you wanted to a text box to show only if a certain radio button value is selected? This video will show you how I acheived this using jQuery.

Get the code

How do I: Create a SharePoint 2010 development VM

I’ve created a series of videos that show you how to install SharePoint 2010 on a Hyper-V virtual machine. These same steps can be used if you are want to install SharePoint 2010 on VMware. When building your VM you should follow these steps in sequential order.

Step 1: Make your Windows Server a domain controller.

Step 2: DisableLoopbackCheck

Step 3: Enable desktop experiance and

Step 4: Add Active Directory Users

Step 5: Setting Windows Updates

/

Step 6: Install SQL server

Step 7: Install SharePoint 2010

Publishing an Administrator-approved form template

If you add custom code to InfoPath 2010 form template you will need to publish the form as an “administrator-approved” form template. Publishing an administrator-approved template is not an intuitive process (in my humble opinion). So, I create a video that will give a step-by-step of how this is done.