Apr 22, 2012

New features of SharePoint Designer 2010

Read this article, to know the Basics of Workflow in SharePoint.
Read this article, to know about Implementing Designer workflow in SharePoint using SharePoint designer 2007.
In this article, we will come to know about the new features added in the SharePoint designer 2010 for the workflow.

What is new in workflows in SharePoint Designer 2010?
In the SharePoint 2010 designer you will see a ‘ Work flows’ tab in the ribbon on the top. Now you can create three types of workflow in SharePoint 2010 using designer 2010:


Ø  List Workflow – This is associated with a specific list or libraries in SharePoint.

Ø  Reusable Workflow – This type of workflow can be associated with multiple lists or content types. It is more flexible than the List workflow type. Later this content type can be used with a list. One more advantage of this type of work flow is you can import it to Visual Studio and we can write code to enhance this type of workflow.

Ø  Site Workflow – This workflow is not associated with any lists or site content types and can be started from All Site content in the page i.e., it operates on the site level.

When you create a workflow, you will see the following new options in the ribbon which makes the user to create and trouble shoot the workflow in SharePoint very easily.

Now let us know about the new options for implementing the workflow in SP 2010 designer. Particularly in the ribbon interface.


  1. Save button – Now you can save the workflow. This option was not available in SharePoint Designer 2007.
  2. Publish button – By clicking the publish button, you can publish the workflow to the SharePoint site.
  3. Condition – Here you can implement the conditions for the workflow.
  4. Action – Here you can add multiple actions when a specific condition occurs in the workflow.
  5. Export to Visio – Using this option, you can convert a workflow and show it in a diagrammatic representation to the user which gives clear understanding, actions, process, people involved and status of the workflow.
  6. Initiation Form Parameters – you can define the starting parameters for the workflow.
  7. Local Variables – Here you can define the internal variables of the workflow using this option.

Apr 16, 2012

Workflow using SharePoint designer 2007

To know about the basics of the Work flows in SharePoint, read this article.
In this article, we will learn how to create a designer workflow in SharePoint designer 2007.
Scenario:
1.   Create a workflow in SharePoint designer 2007
2.   This workflow should be automatically triggered when an item is created or updated in a SharePoint Document library
3.   When the workflow is initiated, then the document created or updated in the document library should be copied to another document library
4.   Also, we will have parameter (flag) in the document library whether to move or not in the document library.

Solution:
We will create two document libraries named, “Draft Library” and “Publish Library”.
In the Draft Library we will create an additional column named Move to Publish Library of type Choice menu (YES or NO)
When a document is uploaded or updated in Draft Library with the flag value equals to yes, then the workflow should be triggered which will copy the item to the Publish Library.

Steps:
Open the SharePoint site in the designer and click on File -> New -> Workflow


Give the name of the workflow and Select the document library for the workflow to be associated (Draft Library in our case). Then Select two options Automatically starts the workflow when an item is created or change and click on Next.


In the Step1, click on the conditions and select Compare Draft Library field


Now, select the Move to Publish Library column and Value equals to Yes as shown below



Now we will apply the action for the workflow. Click on Actions -> Copy List Item. 


Now select Draft Library to Publish Library in the values as shown below


Once you click on finish, then the workflow will be associated to the “Draft Library”.


Navigate to the SharePoint Document library and when you check the workflow settings, and then you will see the MoveDocuments workflow associated with the Draft document library.


Now, we will test the workflow. Go ahead and upload a document into the “Draft Library”. Select YES in the Move to Publish Library option as shown below:


Now, our workflow will be initiated and you will see the status of the workflow (completed) in the document library as shown below:



Click on the completed in the document library where you will be navigated to the workflow information as shown below:


Now, navigate to the publish library, you will see the document being copied as result of the workflow as shown below:


Now, at the end of this article we have learned the following from this article:
1. Creating a Designer workflow in SharePoint using SharePoint designer 2007.
2. Used workflow to copy an item form one document library to another document library.


To know about the new features added in SharePoint Designer 2010, read this article.

Free to comment if this article helps you!

The security validation for this page is invalid in SharePoint

Sometimes, when a user with least permissions in the SharePoint site, creates or updates an item, then the following error will be shown:
“The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again”

When you are creating a custom web parts or creating custom solutions, your code will run with your credentials.

Not everybody has full control in the SharePoint site, so when a user has read only rights and try to update an item in the list or SharePoint Document library, then the code will throw an access denied error. This happens, when the code needs access to objects that are not in the scope of the user credentials.
Here comes the concept called impersonation (ability to control the identity under which code is executed) in ASP.Net. This will allow you to run your code with the help of a user who has correct permissions to run it.

Namespace: Microsoft.SharePoint
Assembly   : Microsoft.SharePoint (in Microsoft.SharePoint.dll)

In SharePoint we have built-in function to accomplish this: SPSecurity.RunWithElevatedPrivileges, it runs with the System Account User.

Solutions:
1. Add the “SPSecurity.RunWithElevatedPrivileges = True” in the code as shown in the example below:

2. Or in the Central Administration -> Application Management -> Web Application General Settings -> Select web application
In Web Page Security Validation, change security validation is off.
Note: The 2nd solution is should not be followed as per the best practices of SharePoint.

Workflows in SharePoint

What is a Workflow in SharePoint?
Ø  In simple words, we can say workflow is a serious of activities occurs in steps which will produce an output at the final step.
Ø  In SharePoint, workflow is an automated movement of documents or items through a sequence of actions or tasks that are related to a business process
Ø  Business process is a sequence of steps that occurs on a document or a task or an item and finally produces a result as an outcome.

Types of Workflows
Basically, there are two fundamental types of workflows in the SharePoint:
                       
   1.   Sequential workflow
It represents the steps that execute in order until the completion of last activity. It is represented graphically in flowchart with start, end and all the sequential activities in between.
Example

   
  2.   State-Machine workflow
It represents a set of states, transitions and actions. As sequential workflows, it does not have prescribed execution flow and need not have an end. It can have any number of states and transition and it can any items related to any transition.
Example


The different types of workflow in the various versions of SharePoint present by default are listed below:

Ways for creating workflows in SharePoint
The different ways of creating the workflows in SharePoint are as follows:
    1.   In SharePoint site directly
    2.   SharePoint Designer
    3.   Microsoft Visual Studio with workflow extensions installed (WWF- Windows Workflow Foundation) – basically called custom workflows
    4.   Third party tools like K2 Black Perl, Nintex, etc.,

What are the pre-requisites for creating a workflow in SharePoint?
    1.  There should be a at least one list or document library to create and associate a workflow.
    2.   If you do not have a single list or document library in your site, you will be prompted for creating a list or library.
    3.   If you want your workflow to be associated with custom columns or settings in the site, then those changes should be made before you create the workflow so that it will be available in the designer.

Advantages
 Ø  Allow the business activities to be automated, enabling actions such as document review, approval, issue tracking and signature collection.
 Ø  Allow the document to be routed to one person to another for approval by assigning a task to each person. This is followed by analysis, review, and approval and finally the document is published. Hence making the document management easier.
 Ø  Also improves the collaboration in an enterprise.

To know about creating a designer workflow in SharePoint using SharePoint designer 2007, read this article.


To know about the new features added in SharePoint Designer 2010, read this article.

Apr 7, 2012

Exporting SharePoint User Groups with Group Names

In the article Exporting SharePoint User Groups into Excel, we have learned about exporting the SharePoint user groups into excel. Here we are able to export all the users in a SharePoint site but we are unable to sort the users with the group name.
In this article, we will learn a small work around filter the users with the group name.
We can use SQL Query to fetch this data.
Connect to the SQL server and open a new query in the content database where your SharePoint site resides.
The SharePoint content DB does not expose the tables (for lists, libraries, users, etc.) in the database directly.
The below is the query which will fetch all the users in the SharePoint site with the user groups in a separate column in the result.
SELECT dbo.Groups.ID, dbo.Groups.Title, dbo.UserInfo.tp_Title, dbo.UserInfo.tp_Login FROM dbo.GroupMembership INNER JOIN dbo.Groups ON dbo.GroupMembership.SiteId = dbo.Groups.SiteId INNER JOIN dbo.UserInfo ON dbo.GroupMembership.MemberId = dbo.UserInfo.tp_ID
Hope this helps you!
Please free to comment. Always your comments makes me to write more!