Thursday, January 26, 2017

System.NullReferenceException: Object reference not set to an instance of an object when deploying SharePoint 2013 workflow solution


I was trying to deploy a workflow solution using Visual Studio 2013; when I tried I got an exception as “Error occurred in deployment step 'Activate Features': System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.SharePoint.WorkflowServices.WorkflowSubscriptionStorageEventReceiver.ItemUpdating(SPItemEventProperties properties)”.


We have to configure Workflow Manager on a server that is part of the SharePoint 2013 farm and on which communication takes place by using HTTP.

  Register-SPWorkflowService -SPSite "http://sharepoint-sp:29375/" -WorkflowHostUri "http://localhost:12291/" -AllowOAuthHttp


How to create a SharePoint webpart with custom webpart property/properties


Recently one of colleague want to create a webpart for SharePoint using C# as programming language. One of his requirements is to that “user wants to pass values through custom webpart property.” So I created a sample for him.


Here is the code and also you can download the .sln file from my drive by clicking below URL.

namespace CustomProperty.CustomWebPartProperty
    public class CustomWebPartProperty : WebPart
        private string _name = "Suhail";//The default value to display
        WebDisplayName("Label Text"),//WebPart property display name
        WebDescription("Label Text to appear in Label"),//Property discription
        Category("Custom"),//Custom webpart property catogory
        public string Name
                return _name;
                _name = value;

        protected override void CreateChildControls()
            Label name = new Label();
            name.Text = Name;



You can see your custom webpart property at the end of the webpart setting.

When you need values which should be able customize don’t save in web.config file; You may use custom webpart properties.

Tuesday, January 24, 2017

“The attribute 'autoeventwireup' is not allowed in this page” issue in SharePoint 2013


Recently we deployed two wsp solutions in an environment. One wsp consists of master page and the other one consists of a site page with code behind where I use events like onclick and all.

After the deployment when I try to access the aspx page we got the above error.


Solution 1.

Remove the code behind file and create a web part and add the web part in the page.You can see my blog post on how to create site page without code behind.

Solution 2.

Go to Site Settings page, under the Site Action section, click Reset to site definition.


Then give your page url and click Reset.


Check your page.

If its still the same give your master page url (which ends with .master) and repeat the above step.

Now your page should work fine.

Tuesday, January 17, 2017

How to disable client side people picker using JQuery in SharePoint 2013 | SharePoint Online


I had created SharePoint people picker using the example from msdn in my aspx page. I had to disable people picker through JQuery in order to full fill my client’s requirement.


According to above mentioned msdn post people picker is initiated on.

  <div id="peoplePickerDiv"></div>

So the id of the div is peoplePickerDiv. So with that I will show the solution.

Step 1:

Create an object of people picker.

  var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;

Step 02:

Set Enable state to fasle.


This will disable the people picker. But you can remove the people objects with X sign. So in Step three we have to remove X.

Step 03:

Remove the X image.



Now the people picker is disabled.


Sunday, January 1, 2017

PowerApps for iPhone

Wishing you a Happy New Year with the hope that you will have many blessings in the year to come.

These days I was looking into PowerApps and I installed PowerApps app from iTunes in order to test PowerApps.

Step 01

Search PowerApps in iTunes and Get It.


Step 02

Your screen will be looking something like below. Sign in with your Office 365 account.



Step 03

Once you login you can see all the apps which you have the permission for.


Then you can navigate through the apps and can use them.




I’m looking forward to write more on PowerApps in upcoming days.