Monday, March 4, 2013

14 hive directory structure in SharePoint 2010

In this post I will list down some important directories or folders used with SharePoint 2010 server. The 14 hive is located under "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14". If you explore the 14 hive you would see below folder structure.























Lets Start with some directories which are related to SharePoint 2010 installation,Configration and its files,
  • C:\Inetpub\wwwroot\wss - Directory for default location of IIS SharePoint websites
  • C:\ProgramFiles\Microsoft Office Servers\14.0 - default installation directory for SharePoint 2010 binaries and data.
Frequent usable 14 Hive directory folders are as follow,

ADMISAPI
Contains the soap services for Sharepoint 2010 Central Administration
CONFIG
Contains files used to extend IIS Web sites with SharePoint Server
Help
Contains Html Help file used by configuration wizard
ISAPI
Contains all the standard Web Services for SharePoint and some additional DLL’s, resources and configuration files that the web services use
LOGS
Contains all SharePoint related logs will see. This is important when any problem or error occur in SharePoint you have to trace the logs files in this folder to get the error message
TEMPLATE
Contains the core web site functionality like the features, templates, configurations, resources of a web site
WebServices
Contains where the SharePoint back-end Web services are hosted, for example, Excel and Search


Following files are undergo with appropriate directories listed down,

ascx in web part/user controls 
14\TEMPLATE\CONTROLTEMPLATES\ProjectNamespace\usercontrols.nameUserControl

aspx in master pages - 14\TEMPLATE\LAYOUTS. 
Identical copies in  14\TEMPLATE\GLOBAL

      css in master page - 14\TEMPLATE\LAYOUTS\1033\STYLES\     OR 14\TEMPLATE\LAYOUTS\1033\STYLES\Themable

         js in master page  - 14\TEMPLATE\LAYOUTS\1033

      css in webpart styling - 14\TEMPLATE\LAYOUTS\STYLES

            js in webpart scripting  - 14\TEMPLATE\LAYOUTS\

        feature.xml in a feature - 14\TEMPLATE\FEATURES\FeatureName\ 
     
      dll in custom assembly -14\BIN\
     
      xslt in ItemStyle14\TEMPLATE\LAYOUTS\XSL


Enjoy !


Thursday, January 31, 2013

Connecting Visual Web Parts programmatically  

Visual web parts allow developers to easily design the user interface as they are doing in conventional ASP.Net applications. The main advantage of connected Web Parts is to exchange data between web parts at run time. Here we are going to use two visual web parts one is called Tags as provider web part and other one is called Items as  consumer web part.

Tags web part retrieve all the items from tag list. Tags list have two columns which are tag and connection which is shown below


Items web part which is act as filtering web part to retrieve filtering items from Items List. Item List is shown below.
Now,  When we click tag from item web part, particular connection for the selected tag should pass to the items web part and filtered from Item A and Item B. For this first I m going to create tags web part to get all tags and connection properties from Tags List. (Note - Bind all the tags in link button and pass connections as command argument of this link button in Grid View ). Tags Webpart is shown below

Interface 
Now lets set the connection provider attribute to Tags web part. First define the Interface that will specify the data we wanted pass or exchange from one web part to another web part.

    public interface ITagString
    {
        string TagString { get; set; }
    }

Tag web part - Provider web part
Now in the Tag web part class, you need to implement the TagString property which is a string as you defined in the Interface. Actually the webpart will load the user control to its control collection in the CreateChildControls. 

1- Implement the ItagString Interface
2- Implement the get and set methods of the TagString property of ITagString Interface
3- ConnectionProvider property after the CreateChildControls subroutine. which will expose the interfacing  data to the Consumer web part.

Here you can pass the connection string using Link button command events

Items web part - Consumer web part
In the Item web part , create an object for Interface “ITagString”. The purpose of this variable is to receive/consume data from the other web part. So you can create a web part variable in user control and a user control variable in the web part code and inside CreateChildControls method, assign the web part variable 

1. User control variable to pass the value to ItemsUserControl class
2. Method will get the Interface ref and returns the value passed by provider web part

Now filter the Item list based on this parameter.
1- Reference from Items web part class
2- Label to print passed parameter
3- Filter the Items list based on parameter

Configure the web parts to enable connection (After deployed)
Following steps are shown how to enable the connection from tag web part and items web part.
When you are done, you will end up with 2 web parts on a web parts page that will communicate with each other as you make click on tags.
Enjoy!


Friday, January 4, 2013


SharePoint Application Development Life Cycle

SharePoint Application Development Life Cycle is the basic concept for every share Point developer. The SharePoint Application development has some additional important methodologies when compared with the usual software project life cycle.

SharePoint Development Life Cycle Process

  •  Capture Business Requirements
  • Solution Architecture
  • Development and Build
  • Testing
  • Quality Assurance
  • Deployment


Capturing  Business Requirements in SharePoint Projects
The SharePoint Business Analyst will work directly with business users to document requirements, analyze business problems and implement solutions. This requirement capturing process mainly covers, requirements elicitation, analyzing requirements, validating requirements,documenting requirements.

How does it happen ?
  • Conduct an analysis of the existing SharePoint systems to ensure all functional requirements are understood and captured
  • Using wireframes and UI mockups for describing business processes and expected functional modules
  • Verifying all SharePoint procedures and limitations
  • Educate stakeholders in SharePoint
  • Document validated requirements, improvements and issues

Solution Architecture
The Solution architect is the most important role in the SharePoint Project Life cycle because he defines the structure of the ‘Solution Design ’of the Project. In this phase reference Architecture, reference implementations and tools for faster development of prototypes are defined

How does it happen ?
  • Information Artifacts – (define data flow, use cases and managing artifacts)
  • Information Architecture
o   How to organize the information in SharePoint Projects
o   Governance (Ownership, Retrieval and Security)
o   Contents and content types
o   Navigation and meta data
o   Users
o   Look and feel / SharePoint branding/Search
  • Logical Architecture
o   Which features will be used and for what
o   Logical design of proposed solution
o   Service levels and administrative policies
  • Capacity planning and physical architecture (network Requirements and storage managements)


Approaches in Development and Build
The term “SharePoint Development” always brings up some difficult discussions when combined  with “Developers” who use Visual Studio, write managed code (C#/VB.NET) and “Developers” who use SharePoint Designer and write client side code (HTML/JavaScript/XSLT) to build their applications. Essentially these are both forms of SharePoint Development.

How does it happen ?
  • Analysis, design, development, and deployment in SharePoint
  • Conformance to the coding guidelines
  • Team development
  • Standalone development environment
  • Shared development SharePoint Server
  • Team Foundation Server

Approaches to Testing and Quality Assurance
Since SharePoint is a collaborative platform due to the wide range of rich features, configuration options and the functionalities it provides, it becomes obligatory to test and track applications with systematic understanding in terms of functionality, usability, security, performance and various platform layers.

How does it happen ?
  • Build Test Environment
  • Use Test Tools and Automated Testing
  • Use Mocking Frameworks
  • Unit Tests and UI Tests
  • User Experience
  • Quality testing in each phases
Deployment
Deployment is the final step of the entire SharePoint Project Life cycle.
  • Standardize deployment
  • Deployment using Power shells




Monday, November 19, 2012

SharePoint Information Architecture

Let’s look the working definition of Information architecture, Information architecture is the art and science of structuring, organizing, labeling, indexing and navigation of information in efficient way to help people/audience find and manage information.

Information architecture facts for SharePoint site
  • How the site will be structured and divided into a set sub site
  • How data will be presented in site
  • How site users will navigate through the site
  • How information will be targeted to specified users
  • How search will be configured and optimized
Three elements of Effective Information Architecture
  1. Context                 2. Content                    3. Users

Lets discuss this topic with real SharePoint portal. Think about this scenario, you need to develop a project management portal for a middle class organization. So what is the context you need to consider?

Context is understanding the business objectives/values and vision in a specified manner. For a project management portal, general purpose should be maintaining a projects and tasks. additionally you need to answer the following questions for define context of this project management portal
1. Whats the specified purpose for developing this portal and expectations
2. Do we have enough requirements?
3. What are the final outcomes from this portal?
4. Difference between existing project management portal?

Content is clear understanding of all the content that is to be stored in the system. Project management portal should have these contents, Documents, audio and videos, meeting minutes, images and services. while we organizing this contents we need consider the followings,
  • Governance (Ownership,Retrieval and Security)
  • Navigation and Metadata
  • Search
  • Physical attributes (Volume, Dynamism)
Governance - when we talk about project list in Project management portal, these are the facts we need to clarify, who can create new projects? who can assign employees for a project?Does it need any approval process? who can view what and when?  

Navigation and Metadata - Metadata is a centralized approach to defining a hierarchical set of terms and enterprise keywords that can be used with the content types in your SharePoint environment. In a Project management portal you should define the metadata clearly.
For example- 

Project Management Portal
  
 ·     Projects
o   Tasks
§  Sub Tasks
§  Sub Task Issues
o   Issues
o   Milestones

·         Calendar
o   End Tasks Today
o   Chart
·         Reports
o   Weekly Reports
o   Monthly Reports

Navigation should define the easy way of accessing all the contents with in site collection/sites. Navigation tab must be a user friendly and hierarchical or tagged.

Search - Making information findable by the people who need it is critical and search is a common tool that users go to to find things quickly. Which means you have to really think about how your information is managed to make it more findable via SharePoint search.
ex- project owner can easily view all the task information by typing of task name.

Physical attributes - How big is your intranet or list? and how long these information valid and keeping old records of data.

Users is understand the users of the content, their behaviors, tasks and their expectations. Initially you should develop the list of audience and specify their tasks / information needs of each group.

Ex- Project management portal users are project owner, admin, project manager, technical leads, developers, etc. Each of them have different level of authorization, 
Project owner - full control 
Project Manager - full control in Project List
                                contribute in employee leaves
Developer -  read - project documents
                      full control  - blogs

So, Information architecture is should be a specified plan and design of organizing information in a SharePoint applications. SharePoint is a powerful tool when you have proper information architecture plan. Don't assume anything, Do a proper way!!! 






Wednesday, October 3, 2012

Creating  SharePoint Custom List and Content Types based on the class POCO using VS 2010

Do you want to customize a list with various column fields and various options? It is so simple by create a custom list and Content types based on the class POCO (Plain Old CLR Objects). Think about this scenario, Customer need lists for storing Project data and every list having various columns and various options. Also customer asking a simple GUI to create customizes lists. The GUI web part showed below. 












In these types of requirements, you need to create lists based on class POCO. The following steps are explaining solution.

Step 1: Create a "Project" class in VS 2010
In this class, List fields are added as Properties of Project Class. Another important thing we need to consider while defining a properties which is, these properties are going to be converted as list fields in SharePoint server. So there are some associate attributes with list fields. Ex- Field Value Required, Each field has different display name, etc.

How to associate these attributes with properties? There is an absolute way in .Net which is Reflections and Attributes


Here, I’m going to consider two associate attributes for a property, one is Boolean value of Required Field and other one is String value of Display Name. Then define a new attribute class named as SPFieldAttribute.cs























Project.cs


































Step 2: Using Visual WebPart to bind the “Project”.cs
Create a visual WebPart to design GUI. Here we need to bind the class properties in field column.







To bind properties in check-box-list as fields.

















Step 3: Convert Property type into SPFieldType
Before Creating a list and content type you need to convert the property type into SPFieldType. Here I use the conversion only for Text, Number and DateTime Fields. 

         String - SPFieldType.Text
         Decimal - SPFieldType.Number
         Integer - SPFieldType.Integer
         Boolean - SPFieldType.Boolean
         DateTime - SPFieldType.Boolean
         Uri -SPFieldType.URL
         Id - SPFieldType.Guid
         Xml -SPFieldType.File





















Step 4: Creating a List and Content type when 'Create' button click




























Now you can create the list and content type mentioned above.
creating custom list in SharePoint Server with selected properties. Before checking this you need to go down and check how to create content type by using VS 2010.

public void createList (string contentName, string listName, Type entityType,
                        List<stringselectedProperties, bool Navigation)             
  {
            // choose your site
  using (SPSite site = new SPSite(url))
  {
    using (SPWeb web = site.OpenWeb())
     {
       SPListCollection list = web.Lists;
       if (!ListExists(web, listName))
        {
         list.Add(listName, "Project List", SPListTemplateType.GenericList);
         SPList newlist = web.Lists[listName];
         newlist .ContentTypesEnabled = true;
         newlist.ContentTypes.Add(web.ContentTypes[contentName]);
         newlist.Update();
         newlist.ContentTypes.Delete(newlist.ContentTypes["Item"].Id);
         SPView view = newlist.Views["All Items"];
         SPField titleField = newlist.Fields.GetField("Title");
         SPViewFieldCollection collection = view.ViewFields;
         foreach (string property in selectedProperties)
          {
           if (newlist.Fields.ContainsField(property))
            {
             SPField Field = newlist.Fields.GetField(property);
             collection.Add(Field);
            }
            else
            {

            PropertyInfo[] properties = entityType.GetProperties();
            foreach (PropertyInfo prop in properties)
            {
            object[] attributes = prop.GetCustomAttributes(true);
            if (((SPFieldAttribute)attributes[0]).DisplayName == property)
                 {
                  SPFieldType type = ConvertToSPType(prop.PropertyType);
                  newlist.Fields.Add(((SPFieldAttribute)attributes[0]).DisplayName, type
                  ((SPFieldAttribute)attributes[0]).Required);
                  SPField Field = 
                  newlist.Fields.GetField(((SPFieldAttribute)attributes[0]).DisplayName);
                  view.ViewFields.Add(Field);


                 }
            }
            }

        }
      //Enable Navigation
       if (Navigation)
       {
        newlist.OnQuickLaunch = true;
       }

       newlist.Update();
       view.Update();
   }
  }
 }
}

creating Content Type... Here we are adding a field links to the content type.






























So Creating Custom list and Content type based on the class POCO using VS 2010 is simple and having more customized way. Have a fun..:)