C# and .NET step by step with interview questions
Showing posts with label Sharepoint interview questions. Show all posts
Showing posts with label Sharepoint interview questions. Show all posts
Tuesday, May 3, 2011
Thursday, September 10, 2009
SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows
SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows
Introduction
In this tutorial we will concentrate mainly on SharePoint workflows. SharePoint workflow sits on top of windows work flow and adds content centric work flow features. So we will first start with some basics on windows work flow and then move towards share point work flows. Finally we will see how we can create work flows using sharepoint designer and visual studio 2005 and 2008.
Please feel free to download my free 500 question and answer videos which covers Design Pattern, UML, Function Points, Enterprise ApplicationBlocks, OOP'S, SDLC, .NET, ASP.NET, SQL Server, WCF, WPF, WWF, SharePoint, LINQ,SilverLight, .NET Best Practices @ http://www.questpond.com/
You can download my free ebook which 400 FAQ questions and answers for WCF,WPF,WWF,Silver light and many more technologies. http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip
What is Windows Workflow Foundation?
WWF is a programming model for building workflow-enabled applications on windows. System. Workflow namespace has all the necessary modules to develop any type of workflow.
What is a Workflow?
A Workflow is a set of activities, which is stored as model and they depict a process. Below figure depicts clearly the difference between Workflow and Activity. Every task is an activity and group of activity depicts a complete workflow. Workflow is run by the Workflow runtime engine.

Figure: -Work Flow Foundation Architecture
Workflow model can be written in pure .NET code, pure XAML or Mix of XAML and .NET Code. A workflow model is compiled and can execute under windows, ASP.NET, Web services or windows services application.
What are different types of Workflow in Windows Workflow foundation?
There are two basics type of workflow Sequential Workflow and State machines workflow.A sequential workflow has clear start and finish boundaries. Workflow controls execution in Sequential workflow. In sequential execution, one task is executed after other. Sequential workflow is more rigid in format and execution path has a determistic nature.
A State machine workflow is more dynamic in nature. Workflow has states and the state waits for events to help it move to next state. In State machine execution path is undetermestic nature.
Below figure shows visual conceptualization of fundamentals. You can see in Sequential workflow the execution path is very determent. Shiv performs the entire task sequentially and these tasks are very determent. Now have a look at the second workflow. Every state goes to other state when it receives some external events. For instance when Shiv is seeing star trek there is an event of flashing news which triggers him to see the flashing new.
Is SharePoint workflow same as windows workflow?
The first basic important point to note is Sharepoint workflow and windows are not different entities.The base for sharepoint workflow is window workflow. In other words sharepoint workflow sits on the top of windows workflow and adds the human work flow flavor.
The below figure reflects the broader definition of sharepoint workflow. It takes the core windows workflow from .NET framework and then applies content centric workflow on it.
Content centric workflows are nothing but simple windows work flow attached to list, documents and custom contents.

Figure :- Content type workflow
You can visualize sharepoint workflows as windows workflow with human workflow touch and feel.
The human work flow touch and feel comes when the work flow is attached to a content type like list, document etc.
For instance let’s say we have made approve and disapprove windows work flow. You can attach this work flow with a student content type and the human work flow for student then becomes student passed and student failed. If the content type is invoice then approve work flow can become a invoice paid work flow and disapprove can become invoice not paid.In other words sharepoint workflow is content centric and they depict human work flow.

Figure :- Approve and Disapprove
What are the different stages of SharePoint workflow life cycle?
Sharepoint workflow cycle is very much unique to Sharepoint environment. As we said sharepoint workflow are always connected in context with a sharepoint content like list or a document.
Figure: -Four different stages in Sharepoint workflow
There are four stage in the sharepoint workflow cycle associate, initiate, modify and complete.
Associate: - As said workflows in sharepoint are always talked in context with a content type.
So the first step is to associate a workflow with a content type like list or a document.
Initiate: - The second step is to initiate the workflow instance. Work flows are nothing but classes finally so a workflow instance needs to be created to start the work flow in action.
Modify: - Later the workflow instance is modified as per the workflow stages.
Complete: - Finally the workflow object is terminated.
Figure ;- Screen and sharepoint workflow
The web forms of share point interact with WSS who in turn then interacts with the windows work flow runtime. The windows workflow runtime passed details to the appropriate workflow instance depending on the data passed by WSS.The sharepoint workflow instance then runs the work flow logic and takes appropriate action accordingly.
What is a three-state workflow in SharePoint?
Three-state workflow helps organization to track workflows which has three states and two transitions. Its designed to track status of list item , task etc. With each transition between states the work flow assigns the task to some person and sends a email alert about the task.
Figure: - Three state workflow
In order to better understand three-state we will create a simple task list. This task list will go through a review process. Following is how the workflow will be executed:-
• Administrator creates the initiates the task. The task is assigned to the reviewer.
• The reviewer then reviews the task, makes his comments and makes the task in progress. Once he makes the task in progress it’s automatically assigned to the acceptor.
• Acceptor finally does the complete review and closes the task.

Figure: - Three state example
The first thing is to add two users in our computer domain one is the reviewer who will review and the other is the acceptor who will close the task initative.

To see the workflow go to Site actions Site settings Workflows. You will see the ‘Three-state’ workflow as shown in the below figure.

Let first create a team site so click on Site actions Site libraries and lists create a new content Sites and workspaces and give some nice name like ‘My team site’ Now click on ‘My team site’ , click on tasks and then click on list settings as shown in the below figure.

Once you click on ‘List setting’ you will see lot of options. Goto the permission and management section and click on ‘Workflow Settings’ as shown in the below figure.

You will prompted to create a new work flow. So create a new workflow and you will need to fill in details of the workflow as shown in the below figure. Give a nice name to the work flow, for the current sample we have given the name as ‘My workflow’. We have specified saying that create workflow as soon as the item is created.

A workflow will have three states an initial state, middle state and final state. These states will be decided on the choice field of the task list. So when the status is having value ‘Not Started’ then the work flow is in the initial state. When the status is with value ‘In progress’ then the workflow is in middle state. When the status is completed that means the work flow object
will be terminated and the workflow will be marked as closed.
Now the second step is to tell the three-state work flow what needs to be done on every work flow state. So let’s fill what should happen when the work flow is initiated. When the work flow is initiated it will be allocated to the user ‘reviewer’. You can see the values visually in the below figure.

When the reviewer reviews the document it’s assigned to an acceptor. So when the workflow is in the in progress state it’s assigned to the acceptor for final closure.

So now that you have attached the work flow with the list its time to invoke the workflow on the list. \Click on new to add a task to the task list. Below are the details of task which we need to enter.
What we have done is we have entered a wrong statement with spelling mistakes.

Now as soon as you click ok , you will see that the task is assigned to a reviewer.

Now login as reviewer and click on ‘What is your name’ ?
Now as reviewer you will correct the sentence and mark the task as ‘In progress’.

As soon as you mark the task as in progress it’s assigned to the acceptor. Now login as a acceptor and mark the task as complete.

Once done click on work flows and you should be able to see a complete tri-state flow.

You can see how the work flow was initiated , how the reviewer reviewed it and finally the acceptor closed it.

Does sharepoint only have three-state workflow ?
If you install WSS then you will only see one work flow that is three-state workflow. But with MOSS you
will see 4 more workflows which cover almost all the scenarios you will ever need for a workflow.

How can we create sharepoint workflow using sharepoint designer ?
Sharepoint designer helps us to create workflows and attach the workflows to a content type like list , document etc. In other words Sharepoint designer creates workflows and publishes the workflow on the sharepoint server site.
To understand it better we will build a simple work flow of completed and incomplete tasks.
We will create two lists one is the incomplete tasks and the other the completes tasks. The workflow will flow something like this:-
• User will create a task and enter the status of the task.
• If the task is incomplete nothing will happen.
• Once the task is marked as complete. The task will be copied from incomplete task list to completed task list.
• The task will be deleted from the incomplete task list.

So let’s understand the eight important steps we will need to create the above work flow using sharepoint designer.
Step 1 :- Create a team site .
Step 2 :- Create two task list one is incomplete task list and the other completed task list. To create task list click on site action Create: - Add a new library list create a task
Step 3 :- Start the Sharepoint designer.

Step 4 :- Open the site in your sharepoint designer using click on file open site.

Step 5 :- Go to workflows by clicking on file new SharePoint content and click ok as shown in the below figure.

Step 6 :- This is a important step. In this step we define two important things first is this work flow will be attached to which list. Currently we have attached the work flow to incompleted tasks list. Second we need to define the events on which the workflow should be activated. For the current scenario we have considered two events one when the item is created and the second when the item is updated.

Step 7 :- This is one more crucial step where we need to define on what condition the work flow will execute and what action should take place if the condition is true. So when a task status is completed then two actions will take place. First the task will be copied from the incomplete task list to the completed task list. Second the task is deleted from the incomplete task list.

Once you click finish you can see the work flow created in the share point designer. This workflow is also published to the sharepoint server,

You can see if the work flow is associated with the incomplete task list. Go to incompleted tasks Settings List settings Workflow settings ,
you can see the work flow is attached to the incomplete task list.

Step 8 :- Ok , now it’s time to see the work flow in action. So go to incomplete task list and create a task with status completed.

Once you click ok you see the task for some seconds in the incomplete tasks list and then the task is copied to the completed task list and deleted from the incomplete task list.

How can we create custom workflow using VS 2005 and VS 2008 ?
Coming soon…..I was really tired in this question so left it for some other time. I promise I will update it soon.SharePoint Quick Start FAQ - Part 5
Introduction
This article is the Part 5 of the SharePoint. Please feel free to download my free 500 question and answer videos which covers Design Pattern, UML, Function Points, Enterprise ApplicationBlocks, OOP'S, SDLC, .NET, ASP.NET, SQL Server, WCF, WPF, WWF, SharePoint, LINQ,
SilverLight, .NET Best Practices @ http://www.questpond.com/
SharePoint is about centralizing documents, how similar is to the windows folder?
As discussed in the previous questions SharePoint is all about centralizing documents. Consider the below company example where the CEO’s computer, accountants computer, sales persons computer and the customer personal pc are storing the documents in their own personal folders. The way they send documents to each other again varies from person to person.
SharePoint centralized everything in central server. So with this approach we do not have different copies of document scattered in personnel PC. The most important point is the backups and versioning can now be managed through the central server.
Consider the below figure which shows a simple folder with ‘courses’ as the top folder which has later has ‘networking’ and ‘programming’ folder. The ‘programming’ folder has ‘dotnet’ and ‘java’ folder which has a word document ‘SharePointFoBeginners.doc’.
Below is a just a zoomed picture of the folder structure we see above.
So if we want to implement the same in SharePoint.
Step 1:- Click on the right side ‘Site actions’ menu and click on ‘Site Settings’.

Step 2: - You will be shown lot of option , click on ‘Site libraries and lists’ and then click on ‘Create Content’

Step 3: - You will then be popped up to create a page. We will select ‘Basic page’ for our current situation.

Step 4: - Give a page name and click on ‘Create a new document library’. The document library helps us to provide the necessary folder structure and document centralization.

Step 5: - We need to specify a name for the document library. We will specify the name as ‘Courses’ because that forms the folder name for the top folder.

Step 6: - Once you click on create you will see the courses directory at the right hand side of the quick launch menu.

Step 7: - So we have repeated step 6 and created our folder hierarchy. Now we can upload document using the upload document as shown in the figure below.
Once document is uploaded you can see the document with folder structure as shown below. Below folder structure represents exactly your windows folder structure.
In case you want to have a windows explorer look and feel. Click on action and click on open with windows explorer.
You can see the exact windows folder look and feel of your sharepoint documents.
Can we add custom fields to our document library documents?
Organizations normally have 1000’s of documents and at one point of time it becomes difficult to search and organize these documents. If you see in our previous example where we had created a document library sharepoint has only given four fields. Now if you want to add a new field called as department and with this we can filter out which document belongs to which department.
To add a custom column click on settings and click on create column as shown in the below figure.
You will then be popped to specify a name for the custom column. For the current scenario we have names it as ‘DepartMent’.
Once you click ok you can see the newly added custom column.
If you want specify data in the custom column click on the document and click edit properties menu as shown in the figure below.
You can now specify the department name.
You can now use the custom column for search and applying filters.
What are content types in SharePoint?
Content types are extensions to custom types. Content types bring in central control and consistency on custom data type. For instance in the previous example we had added custom type as ‘Department’ now someone can add the custom field as ‘Dept’. In other words this can bring in inconsistency and we will not be able to query and filter data in a consistence manner. So in other words we can define a content type and then apply this content type across documents. In other words we can really drive organization level policies using content types.
To create a content type click on site action – site settings – from galleries section click site content types and you will be shown a list of existing content types.
To create a new content type click create hyperlink from the same screen which is showing list of content types.
You will thrown up a screen where you need to specify the name of your content type the parent content type and group for the same.
Once the content type is created you can add new columns using the link ‘Add from new site column’. Our custom type inherited from document content types so it had two properties i.e. name and title. We had also added ‘DepartMentName’ as the custom column in the content type.
You can add new columns using the ‘Add from new site column’. We had added the ‘departmentname’ custom field for the current instance. Below figure shows different options and data type for custom columns which are added.
Ok, now it’s time to apply this content type to our document. Click on the settings menu and then click on ‘Document library settings’.
You will be popped up with the details of the content type. Click on ‘Add from existing site content types’ and select the custom content type we have just created i.e. ‘MyContentTypeForDocuments’.
You can now select the content type for your document library.
You can see how our custom content type is seen when we try to upload the new document.
If you edit the properties you can see the ‘departmentname’ custom column in your content type.
What’s the difference between content and custom columns, they do the same thing?
Custom columns can be added by end user and end user can mistake. For instance someone can add the custom column as ‘Dept’ and someone can add the column as ‘Departmentname’. Content define a document data type. For instance your invoice content type can have invoice number, invoice amount etc. Your sales content can have sales date, customer code etc.
In other words content type helps you to force organization level policies. So you can define a content type at the site level. When any user wants to create a document library he can use the appropriate content type. Let’s say the organization wants to implement a policy saying that every document should have departname and version number. So the sharepoint administrator can create a content type called as ‘CompanyContentType’ and all document libraries can use this content type.
So you can use custom columns where the column is very much specific to that document library and will not be repeated you can use the custom column. If you want to implement document level policy and fields across organization you can use content types.
Can you elaborate more on List and Content Types in SharePoint?
SharePoint is all about data and collaboration of the data between different types of users. When we talk about data it varies from user to user and different types of meta-data. For instance below we have four kinds of user’s project manager, accountant, security personnel and HR.
All these four users have different kind of data formats. For instance the accountant needs to save data with different data types and fields like voucher number( 20 character string) , voucher date (MM/DD/YYYY), debit (Boolean true) , credit ( Boolean false) and amount ( Double). The security needs In-time, out-time, items carried and biometrics data.In order to bring a flexible collaborative data model which can be further extended SharePoint brought in something called as List and Content Types. Data was visualized in terms of List data as shown below. With this approach you can add more fields and content type on a need basis.

The best part about organizing data in list is the amount of flexibility and extensibility we can bring in. Some of the flexibility a list type of approach brings in are give below: -
Different views of the list
For instance an employee list can view employee wise or date wise.

Create content from external list storage
You can take a excel and instruct SharePoint to create a list of that type.
Which are the various ready made list types that SharePoint provides currently?
There are approximately thirteen different ready made list types, below mentioned are some of the most used ones.Document libraryUsed for collaborating on documents with support for versioning, check-in and check-out, and workflow. Includes support for deep integration with Microsoft Office.
Form libraryUsed to store XML documents and forms for use with Microsoft Office InfoPath.
Wiki page libraryUsed for collaborative Web pages based on wiki pages, which are dynamically generated and collaboratively edited Web pages.
Picture libraryA specialized document library enhanced for use with pictures. Includes support for slide shows, thumbnails, and simple editing through Microsoft Office Picture Manager.
AnnouncementsUsed for simple sharing of timely news with support for expiration.
ContactsA list for tracking people and contact information, with support for integration into Microsoft Office Outlook and other WSS-compatible contacts applications.
DiscussionsA simple list for threaded discussions with support for approval and managing discussion threads.
LinksA list for managing hyperlinks.
CalendarA list for tracking upcoming events and deadlines. Includes support for integration and synchronization with Office Outlook.
TasksA list of activity-based items that can integrate with workflow.
Project tasksAn enhanced tasks list with support for Gannt chart rendering and integration with Microsoft Office Project.
Issue trackingA list for tracking issues and resolution, with support for prioritization.
Custom listAn empty list definition for extending with custom columns, or created using Microsoft Office Excel spreadsheets.
Subscribe to:
Posts (Atom)