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..:)

Sunday, August 19, 2012


Creating a basic List workflow in Custom List using SharePoint Designer 2010

Think about this scenario, You already have a SP Custom List for keeping records of employee’s leave details in your organization. You need to have a level by level of approval Process with two managers.
The tasks are listed below.
  1. If employee has added a new leave, workflow automatically starts and sends an email alert to the first manager.
  2. If first manager not respond within 12 hours, another Email alert should go to the second manager.
For this demonstration, I’m starting from custom List which is having an employee's leave details.









Click the “List” section from top ribbon to open the List Properties

















Click “Edit List” to edit 'Employee's Leave' list in SharePoint Designer. Now this site will be connecting with SP Designer 2010

















Below Screen shot shows the opened "Employee's Leave List" in Designer windows.






















Click the “Workflows” for create new workflow in left panel. Next click "List Workflow" and select the List name.. Now this workflow is attached with this List.



Enter your new workflow's name and its description.Here i named as "LeaveRequestWF"

















Now, Lets start workflow's function. First need to send an email to first Manager.
Click ---> Actions in top panel  and Choose your particular action. Here we need to select "Send an Email" from core actions.



































Define an Email Message. Here you can use the directory for getting Domain Users.




























While you define an Email body, use current leave items property such as employee name, type, etc.



























Lets define an another action, we need to pause this workflow for a specific time to first manager approval. To do this select actions--> "Pause for Duration". Here you can set pause time in hours, minutes and seconds.






























Lets starts the third part, Need to define  level by level approval process. For that, add a Condition in workflow. Check the Approval status is still pending.























If it is still pending, add another email to second manager. Finally publish the workflow into server.






















Now, go to your workflow and select the "Start Options".Workflows---> Workflow Name---> (Right panel) Start Options..

Workflow is created. Add new items in your list and check if your workflow is start working.
Isn't this very simple and cool
Have fun.