Checking Task Status in SharePoint 2010 Workflow

This question comes up quite often. If you are building a SharePoint workflow (either Sequential or StateMachine) using Visual Studio 2010 and if you sometime want to check the status of your task using code then you can simply use the following code to achieve that.


The above code runs OnTaskChange Activity and uses Task AfterProperteis to get the Task Status.

Pretty Simple !!!

Something went wrong with your my site setup – SP2013

If you have installed SP 2013 environment and trying to use My Sites you may see the following error.


This could be for multiple reasons. First read the following article and make sure you have followed steps mentioned in it for configuring your My Site.

If you have followed these steps correctly then it may be because of server is running low on resources.

State Machine Workflow in SharePoint 2010

I was thinking of writing a blog post on Step by Step State Machine Workflow. Lately I am busy with work and hence did not get chance.

I will definitely write that article in near future but meanwhile you can have a sample State Machine Workflow Project which I have created.

State Machine Workflow Sample

This is just a sample for your learning purpose only. This has not been tested for production use and this sample contains no warranties.

Getting ID of uploaded document or File in SharePoint 2010

If you are uploading a File​ to SharePoint 2010 programmatically and wanted to get the ID of that newly created file then you can use following code.

//Upload your File

SPFile myFile = spList.RootFolder.Files.Add
                (FileUpload1.PostedFile.FileName, StreamImage, replaceExistingFiles);

SPListItem item = imgFile.Item;

// Then you can use item.ID

I am not providing full code for file upload but the key here is to get SPListItem from SPFile class.

I hope it helps.

Set Default value for Enhanced Rich Text Box in SP 2010 using Jquery.

This one was tricky.

If you ever want to set default value for Enhanced Rich Text Box you can use following​ Jquery.

<script language="javascript" type="text/javascript" src="/sites/testsc/Style%20Library/jquery-1.9.0.min.js"></script>

    <script language="javascript" type="text/javascript">
    $(document).ready(function() {    
    $('nobr:contains("Desc")').closest('tr').find('input[id$="TextField_spSave"]').val('Hello World !!!');

This is copied from the thread below.

If you want to insert HTML inside you can simply inesert your HTML as part of setting up value.

$(‘nobr:contains(“Rich Text”)’).closest(‘tr’).find(‘input[id$=”TextField_spSave”]’).
val(‘<table border=”1″><tr><td>Hello </td><td><b>World !!!</b></td></tr></table>’);