Sharepoint 2013 - Avoiding Azure on Dev Box

Let us have a look at this error.
" The parameter 'token' cannot be a null or empty string "
" Microsoft.SharePoint.SPException: The Azure Access Control service is unavailable "

We might have encountered these issues in initial days of working with Apps.
To be specific, this happens with Auto Hosted or Provider Hosted SharePoint Apps.


My First Sharepoint-Hosted App in 2013

I would recommend to read Apps in SharePoint 2013 post before going through this one.
I want to create a SharePoint-Hosted App in 2013 using Visual Studio.
I have created a SharePoint 2013 machine with all required software.
Just as a best practice, even if you are creating a standalone server, enable Active Directory Domain Services.
SharePoint 2013 works better when the system is in a Domain, rather than in a workgroup.

So, I have installed Windows server 2012, enabled all required features. Installed Office 2013, SharePoint 2013, Visual Studio 2012 and Developer tools for SharePoint 2013.

Apps in Sharepoint 2013

Why Apps? What's wrong with Solutions?
The world is getting smaller day by day, thanks to technology. Big desktops became Bulky laptops. Bulky laptops became Notebooks. Notebooks became Ultra books. Now the trend is moving towards Tablets and Smart phones.
So does our applications. Web applications becoming Apps.


SharePoint 2013 Issues Encountered

These are the list of issues I encounter while working on SP 2013 on VS 2012.

While setting up SharePoint 2013 in standalone mode, there are 2 kinds of errors which we may encounter at step8.
Just like many people I ignored it and verified Central Admin and created an application. So thought everything is working. But when you create applications like apps, then you will start getting weird errors like "xxxxxx component is missing, try installing it again"

So clear these issues first and then proceed.


Understanding Sharepoint Custom Claims Provider

Before going into any details, we should answer the obvious question.
                                 Why Custom Claims Provider?
Simple ! Claims auth based on Windows based, Forms based or SAML based authentication will generate Claims. But mostly they may not be compatible with the claim information what we / application require.
Below is a claim set generated by STS in case of Claims with Windows.

For example, lets say Date of Birth is part of AD Group, and when user sign in to my site, i will get DOB as one of the claims. But task of my application is to categorize people into Kids (<18 Yrs), Youth (18 to 27), Middle Aged (27 to 40) and so on . . . which will be done by adding one more extra claim with respective values (kids, youth, middle aged . . . ), based on information provided by default claims(Age calculated from DOB). That task will be done by Custom Claim Provider.

Claims Based Authentication in Sharepoint

In this post we will try to understand the basics of Claims Based Authentication in SharePoint.
Lets start this with Claims.
Claim is a piece of information which will authenticate you with in a set of agreed parties.

Let me put it in a simple way for better understanding. If there is a carnival with entrance fee of 100 bucks and all the rides inside are free. When you enter carnival, you pay once and have the ticket with you. Now every time you get on a ride, you just need to show that entrance ticket. The person operating rides will trust the ticket granted by person near entrance.
So, Entrance ticket is the claim you carry.


Access WCF Service Without Service Reference

                                          Change is Inevitable
This absolutely applies to Client Requirements, but not to our code . In other words, the above statement is one of the 3 design principles of Software architecture.
                                System should be Fault Tolerant.
This means, our system should be adoptable for changes and shouldn't break for every reasonable change.
Reason for bringing up this point is a recent situation i undergo.


Uploading Documents Programatically to a Content Organizer Enabled Site

We have covered Content Organizer / Metadata Routing in SP2010 in earlier post.
We have created all the required infrastructure for meta data routing or Content organizing. So only task remining is uploading the documents.
Well ! we cannot ask the users to navigate to Drop Off library and upload their documents. Right?
So i have created a simple Webpart for uploading the documents for the specific content type.
 Now we need to upload the selected files programatically to Drop Off Library.


Content Organizer / Metadata Routing in SP2010

Clients doesn't bother about content types and sub-sites. All they want is a User-Interface, where they simple upload / download their documents, do some simple tasks.

As a part of Sharepoint application setup or usage, end users will be uploading loads of documents on to the site. So, its our job to make them organized and and easily fectchable.

Content Organizing / Metadata Routing is one of the key Features of Sharepoint 2010, which made developer's and contributer's life easy in this Aspect.

Let me demonstrate the how to configure the Content Organizer for your ease of document management.

Managed Metadata in SP2010 - Simplified

                 Metadata is data about data. 
Well Now you have to tell me wether answer is correct or not?

If you understand above definition, the answer is "Correct".
The concept of metadata exists from ages, and we have been using it in .net assemblies and many other stuff.

Lets take an example of exam report. It will have all the subjects listed and maximum marks, achieved marks, result and grade.  To summarize everything, we call it "Report Card".

When you say "Report Card" , it signifies everything mentioned above. So "Report Card" is metadata using which we can classify all the Marks and grades information.
Now lets see what metadata has to do with Sharepoint 2010.


Load Test Using Visual Studio 2010

I have been writing code from last 7 years and i hope many of us went through below situation.
We always test our code thouroughly, and will send it for testing expecting zero bugs.
When a tester raised an issue with anything, first thing that comes to our mind is . .
After all the struggle we will make it to Production, and smoke test went awesome.
When the users start using the application . . .  "BOOM"


Webparts in Sharepoint 2010

In this post we will see a few commonly used webaprts in Sahrepoint 2010.

1. Content Editor Webpart: This webpart will be used for authoring rich content.This will be available in Media and Content section.


Business Connectivity Services - Architecture

Before comparing BDC vs BSC, one should know that BDC is still a part of SP 2010. It is integral part of Business Connectivity Services (BCS).

One should understand BSC Architecture, before practically implementing it. So, as usually MSDN has everything, and let me bring it on to a post.

Implementing Sandbox Proxy in Sharepoint 2010

In earlier post we have seen the Basics and Architecture of Sandbox & Sandbox Proxy.
In this post we will see how to implement one.

A sandbox is a restricted execution environment that enables programs to access only certain resources, and that keeps problems that occur in the sandbox from affecting the rest of the server environment.

Realtime applications will be hosted and executed in Sandbox environment, but its not realistic to complete a project with in scope of a Sandbox execution. There will be many situations where you need to create a file, accessing file system, execute something with Farm Admin credentials.


Sandbox Architecture

It is important to understand the architecture of how sandbox solutions work before we can talk about restrictions and Proxies.
The word "sandbox" in computers is generally used to refer to a safe area where you can play, without damaging the outside hosting environment. The sandbox in SharePoint is implemented as a separate process where your sandbox solution code will run. In fact, there are three processes.


Sandbox Solution and Sandbox Proxy - Basics

Def:  A sandbox is a restricted execution environment that enables programs to access only certain resources, and that keeps problems that occur in the sandbox from affecting the rest of the server environment.

In SharePoint 2007, custom code requires the farm administrator to trust the code running on the server. In SharePoint 2010 we are introducing a new SharePoint custom code sandbox with isolation and resource limitations (memory, SQL, CPU) that allows administrators to let others safely add and consume custom solutions without impacting overall farm performance and stability.


OAuth Basics

This sure looks like a Branded Car Logo . . . Isn't it.
No, this represents the new authentication mechanism on which most of the sites are working today.

OAuth - Open Authentication.

I love Valet key example. Many luxury cars come with a valet key. It is a special key you give the parking attendant and unlike your regular key, will only allow the car to be driven a short distance while blocking access to the trunk and the onboard cell phone. Regardless of the restrictions the valet key imposes, the idea is very clever. You give someone limited access to your car with a special key, while using another key to unlock everything else.


Html GridView in MVC3

When ever we need to create a grid in MVC 3, we often end up with Telerik grids, due to awesome features and support. But you need to have a licensed version of controls.
What if you don't have license for it and you have to create a Gridview of your own, like below.
Its very simple, and all you need to create is a little Html, JQuery and supporting Action Methods.
Lets see how . . .


Implementing & Consuming ASP.NET WEB API from JQuery (MVC 4)

In this post we will see how to create a our own WEB API service and will consume it in client using JQuery.
This is the UI i am planning to create, which in-turn talk to a ASP.NET WEB API Service for rendering data. We need to create a API Service and an Application consuming it.
Lets do it step by step.


In earlier post we read about how WEB API evolved and what are the features that made it as one of the best frameworks to build or consume HTTP Services.

While going through the post, keep one thing in mind that WEB API is REST Complaint, so it typically consists of Get(),Put(),Post(),Delete() methods.
           Method                                        URL Structure
             Get()                                            api/Values
             GetItem(int i)                              api/Values/i
             Post (i)                                         api/Values/i with Post method
             Delete(i)                                      api/Values/i with Delete method.

Before writing tons of your custom code, lets see what the default scaffold template has given for a WEB API interface.


History Behind ASP.NET WEB API

It is a framework for building and consuming HTTP services that can reach a broad range of clients including browsers and mobile devices. It’s also a great platform for building RESTful services. ASP.NET Web API takes the best features from WCF Web API and merges them with the best features from MVC.
Even before touching code, we need to know why WEB API?

It started with WCF


OData defines an abstract data model and a protocol that let any client access information exposed by any data source. Figure 1 shows some of the most important examples of clients and data sources, illustrating where OData fits in the picture.
 Before going into more details , first look into below videos explaining What and Why.


Merge in SQL 2008

Many a times we came across situation to merge records between two tables. It will be like incremental update i.e., add new records and update existing records based on a reference column.

We usually accomplish this in two statements.
1. A join statement to update records.
2. A insert statement for new records.

Lets execute and see how this works.


MVC - DI & Unity with Lifetime Manager

In this post we will see 2 important things.

1. Using Unity Dependency Resolver
2. What is Lifetime manager and its significance.


Google Page Preview & Google API in MVC Razor

Look at this . . .

Isn't this different from Google home page. Yes it is. This is my custom MVC Razor search page, which i have created with full features of Asynchronous data retrieval, displaying Page Preview . As i cannot write such a powerful search algorithm, i am still using Google API here.


MVC Razor - In Progress Icon

"In Progress Icon" is the best way of intimating a client about server side action, so that he can wait until it is completed.
In this post we will see how to display one in a MVC Razor application.


JQuery Switch - Horizontal Animation / Accordion

JQuery: Horizontal Accordion

  • Deck Details
  • Source Details

Nice ! haa... No Plugins used. Simple Sprite Image used with JQuery. Download the code from below link.


NuGet Package: Facebook helper in MVC Razor

The era of global connectivity has begun. Social networking being the first step in this process, most of the latest technologies are coming up with different kinds of support for social network sites.
One of the famous of such social networks is Facebook.
Recognized this button. Yes, in this post we will see how to implement this kind of functionality in your MVC Razor application with a single line of code.


Entity Framework: Adding DataTable with no Primary Key to Entity Model.

Exception: The table/view '[TableName]' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it.


Delegates & Events

In this post, we will go back to basics of C# concepts. From the time when i am new to .Net development till today, one of the first five C# questions is
" What is a Delegate? What is an Event? What are the Differences? "
Lets see this with a practical implementation.


$.post and $.get in MVC Razor & JQuery

In this post we will see when to use and How to use ajax calls in MVC Razor using JQuery.

When i am trying to create a POC for combination of entity framework and a MVC Application, i came across this requirement which made me to use $.post() and $.get().

Now, people very easily say, $.post() for posting data and $.get() for getting data using ajax call. Great!
But its not that simple as saying it. We need to decide what has to be used in combination of these ajax calls.


Custom Filters in MVC - Authorization , Action, Result, Exception Filters.

Filters in MVC are attributes which you can apply to a controller action or an entire controller. This will allow us to add pre and post behavior to controller action methods.
There are 4 types of Filters. Which were described in above image.

Objective: Learn about filters and create custom filters for better understanding.


Structural Pattern : Decorator Pattern Demo

Decorator Pattern can be defined best by below Image.
Before going into details lets go through the text book definitions and UML diagrams first.

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality.


Unit Test Case writing for a MVC Project

In this post we will learn how to write Unit Test Cases for a MVC project.
One strong reason behind choosing MVC approach is TDD (Test Driven Development).

If we say my Data layer / Business Layer is 100% tested,it should pass all the positive scenarios and fail in all negative scenarios.
In order to do that, we need to write test cases for all the public methods present in different layers of our application and test them thoroughly.

I have created a very simple POC for demonstrating on how to write test cases.


Behavioral Patterns - Observer Pattern

Lets not follow the text book definition of Observer Pattern.
Start with OO Principles.
OO Principle says, "Strive for loosely coupled design between objects that Interact".
Loose coupling brings the flexibility and resilience in system.

Lets take Facebook notifications as an example.
When there is any changes in my profile or wall , it will be automatically notified to my friends.
In this case, i am the subject and My friends are Observers. My friends list may vary. People may be added or removed from the list. But the system should be flexible enough to communicate the information despite of the change in observers list.


Html.BeginForm() vs Ajax.BeginForm() in MVC3

We know that .BeginForm() extension method will create a form tag thus associating form level methods to the page.
I have been wondering what exactly is the difference between both Html.BeginForm() and Ajax.BeginForm() methods in MVC3.
Read many blogs, and everyone says only one thing, In Ajax forms, forms are submitted asynchronously using Javascript. So, this post is to verify the same thing.


DateTime TryParse() and ParseExact() Methods

This Post is from a very good author James Michael Hare, We will look at a couple methods of the DateTime struct that give you additional control over parsing an input string into a DateTime.

Most of us have dealt with using DateTime.Parse() for these tasks, but sometimes you are wanting to parse something that may not be a valid DateTime, or may be in a non-standard format. So let’s look at the TryParse() and ParseExact() methods that can be used to deal with these two situations.

Basics of SAML

Before jumping into practical implementation of SSO, lets know the basics of SAML. 
Security Assertion Markup Language (SAML) is an XML based framework developed by the Organization for the Advancement of Structured Information Standards (OASIS), used for the exchange of security information between different parties. This is an open standard that can be used to exchange security information between different products. 

# SAML V1.0 became an OASIS standard in November 2002. SAML V1.1 
# In September 2003 and has seen significant success, gaining momentum in financial services, higher
education, government, and other industry segments.
# In 2005, SAML V2.0 unifies the building blocks of federated identity in SAML V1.1 with input from higher
education's Shibboleth initiative and the Liberty Alliance's Identity Federation Framework.


Sharepoint Coding Best Practices [MSDN]

This post is straight away from MSDN, but reason being, i found it very interesting and usefull while tuning the performance or while developing custom development projects.


Basics of Single Sign on (SSO)

SSO: Single sign-on (SSO)is a session/user authentication process that permits a user to enter one name and password in order to access multiple applications. The process authenticates the user for all the applications they have been given rights to and eliminates further prompts when they switch applications.