Jul 1, 2012

Visual Studio Workflow in SharePoint

Part II
To know about the Basics and Advantages of using Visual Studio Workflow
read this article.
In this article, we will how to Create a Simple Sequential Workflow Console Application.
Steps:
1. Open Microsoft Visual Studio -> File -> New Project -> Select Visual C# -> SharePoint -> Workflow -> SequentialWorkflowConsoleApplication

2.  You can see the required DLL’s added in the solution for running the work flow in the Solution Explorer

3.  From the Toolbox -> Select Code -> drag and drop inside the designer view as shown below. Double Click on the codeActivity1 -> you will be navigated to Code behind page of the solution.


4. I have initialized a variable with get and set methods and activity for the code1 as shown below:

5. Now, go to the Design view -> From Toolbox -> Drag and drop IF ELSE activity and the code activity for IF and ELSE branch

6. Right click on codeActivity2 and click Generate handlers to create handlers the activity and do the same for codeActivity3
7. Now, we will set the condition for the ifElseActivity1 and 2. Right Click on ifElseActivity1 -> Properties -> Condition -> Select Declarative Rule Condition


8. Give the Condition Name and then Click on Expression for setting the condition:
9. Following are the conditions set for both the activities:


10.Now,if you click on any one of the activity -> properties -> select the name
then -> you can see the two conditions being used in the solution as shown:

11. Finally, I have added the message to be returned for the both activities

12. Now build the solution and then execute the code:

Here is the full solution. Click to download. Happy Sharing!
Hope, you have enjoyed this article.
Please free to comment and share this article, if it helps you!
Happy Coding!!

Visual Studio Workflow in SharePoint

Part I
To know about the Basics of Workflow in SharePoint, read this article.
To know about the Creating a Designer Workflow, read this article.
To know about the New Features added in SharePoint Designer 2010, read this article.
In this we will learn about Basics of Visual Studio Workflows in SharePoint.
Windows Workflow Foundation -WWF:
Windows Workflow Foundation (WF) is a Microsoft technology for defining, executing, and managing workflows.
Why Visual Studio Workflow is necessary?
From the business perspective, we need some custom workflows to be designed and developed in order to meet the requirements. By using designer, we cannot achieve all the custom actions and hence Visual Studio workflows are necessary.
Moreover, Visual Studio is a known environment to the developers (working with Microsoft Software’s) and hence the design and development is very easy.
Software Requirements
  Ø  Windows Server 2003 R2 Download
  Ø  Microsoft .NET framework 3.0 Download
  Ø  Windows SharePoint Services 3.0 Download
  Ø  Microsoft Visual Studio 2005 with SP1 Download
  Ø  Windows SharePoint Services 3.0 SDK Download
  Ø  Visual Studio 2005 Extensions for Windows Workflow Foundation Download
   Limitations of using Designer Workflow:
  Ø  A major disadvantage is that, you can create only Sequential Workflows using designer and not the State Machine workflows.
  Ø  We cannot write custom code and custom activities for workflows while creating using designer.
  Ø  Maintenance and upgradeable methods are very less.
To know how to create a sample Sequential Workflow using Visual Studio, read this article Visual Studio Workflow in SharePoint.

Prevent Outlook from Sending Emails with a Blank Subject

Objective:
In the IT Industry, Outlook is most popularly used as the Email client. The subject line is a very important part of any email. Many times has it happened to you that you have sent an email through Outlook without a subject line? After clicking the Send button, you realize that you have made a mistake (What if it is a case you have sent a mail without Subject to a Client or a Manager?)
By default, Outlook does not validate a mail with a blank subject and here is the solution.
Steps:
1. Open MS Outlook -> Tools -> Macro -> Visual Basic Editor
2. You will see Visual Basic Editor will be opened 
 3. Click ThisOutlookSession which will open the Code Editor paste the below code in the Editor -> Save it and Close the window.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
   Dim strSubject As String
   strSubject = Item.Subject
   If Len(Trim(strSubject)) = 0 Then
       Prompt$ = "Subject is Empty. Are you sure you want to send the EMail?"
      If MsgBox(Prompt$, vbYesNo + vbQuestion + _
            vbMsgBoxSetForeground, _
            "Email Subject is Empty") = vbNo Then
        Cancel = True
      End If
  End If
End Sub
4. Now, restart the outlook. You will be prompted with a window where in Click on Enable Macros.
5. Now try sending an email without subject, you will be prompted for entering a Subject in the Email.

Jun 21, 2012

Jun 19, 2012

Versions of SharePoint

Ø  Microsoft Content Management Server (CMS) (Year 2002)
Ø  SharePoint Portal Server (Year 2003)
Ø  Windows SharePoint Services 3.0 (Year 2003) – Free Ware
Ø  Microsoft Office Share Point Server (MOSS) (Year 2007) (Built on .NET 2.0) –    
   Combination of CMS and SharePoint Portal Server
Ø  SharePoint Foundation Server (Year 2010) – Free Ware
Ø  Microsoft SharePoint Server (Year 2010)

Jun 13, 2012

Databases must be empty before they can be used. Delete all of the tables, stored procedures and other objects or use a different database.

Problem:
I got this error when I tried to stop and start the Windows SharePoint Services Search service by the following:
Central Administration ->Operations ->Services on server->Windows SharePoint Services Search->Stop
Central Administration->Operations->Services on server->Windows SharePoint Services Search->Start
The below is the step by step solution to fix this issue.
Solution:
1. We have to delete some log files of database in the SQL Server by following the path:
Stop the SQL Server Express Service: Start -> All Programs -> Administrative Tools -> Services -> SQL Server -> Right click Stop
2. Now delete the following file in the below locations:
WINDIR%\SYSMSI\SSEE\MSSL.2005\MSSQL\DATA\WSS_Search_ Servername.mdf
WINDIR%\SYSMSI\SSEE\MSSL.2005\MSSQL\DATA\WSS_Search_ Servername_log.LDF
Or in this path WINDIR%\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
3. Restart the SQL Server Express Service by following the path:
 Start -> All Programs -> Administrative Tools -> Services -> SQL Server -> Right click Start
4. Now restart the Windows SharePoint Services Search by following the path:
Restart the Windows SharePoint Services Search: Central Administration->Operations->Services on server->Windows SharePoint Services Search->Start
5. In the Configure Windows SharePoint Services Search Service Settings page, in the Search DB section, give a new DB name in the Database Name field. Click Start.
6. If you give the old DB name you will get the error. Hence try giving the new DB name.
Please free to comment and share this post if it helps you!

The specified database has an incorrect collation. Rebuild the database with the Latin1_General_CI_AS_KS_WS collation or create a new database

Problem:
 I have faced this error when I created a DB in the SQL server and then tried to create the Search Server DB name in the Search Server Configuration Page while configuring the Microsoft Search Server Express 2008.
Solution:
1. The problem is the database created has incorrect collation.
2. We have to change the collation to Latin1_General_CI_AS_KS_WS collation which is specified while configuring the web applications or search server DB in SharePoint.
3.  Connect to the SQL server -> Select the Database created.
4. Right Click on the Database -> Properties -> Select Options page -> Change the collation as shown below:
5. Now try to configure the Search or Web Application in SharePoint, it will work as expected.

Jun 9, 2012

Hiding Default Title Column in a list in SharePoint

In this article, we will know about a small tip, How to hide the default title column which is created by default whenever a list is created in a SharePoint list.
Steps:
1. Whenever a list is created, you will see a default column “Title” in the list.
2. In Some cases, we do not need this and needs that to be hidden.
3. Go to Settings -> List Settings -> Advanced Settings (General Settings) -> Change Allow Management of Content Types to YES
4. Now List Settings page -> Click on ITEMS
You will see the list of columns in the list. Now we want to hide the Title Column and hence click on the Title column
There will be option for permanently hiding the column. Select the option “Hidden will not appear in forms” and click OK. 
5. We have hid the column in the form but it will appear in the VIEW. So, we have to hide the column in the view. Click on the View in the List.
In the Columns Deselect the Title and click OK.
6. When you click on New for adding a new item in the list, then you will not see the Title column in the form or when you view the list, you will not see the Title column in the view.