Wednesday, November 23, 2011

creating sequential workflow SP 2010

Create a sequential workflow using Visual studio 2010 in SharePoint 2010
Here we will discuss how to develop a sequential workflow using Visual studio 2010 in SharePoint 2010. Microsoft provides different project templates to work for SharePoint.
For this first open Visual studio 2010 and then File -> New Project.Then from the new project dialog box choose Visual C# and then Select SharePoint and from there select 2010 and Choose Sequential Workflow template and give a name in the Name box as shown in the figure below and click on OK.

In the next step provide the local debugging URL and you will able to only deploy as farm solution is selected
because you can not deploy a workflow as sandboxed solution. See the figure below

And click on next. In the next step give the name of workflow and select the type of workflow as shown in the figure below

In the next step select the list or library you want to attach the workflow and select where you want to show the history list you want to store as shown in the figure below (SequentialWorkflow_03.png).

The Workflow history list is used to store all events that occur while workflow is running.Here also you can check the check box if you want to automatic associate the workflow to the selected list or library. In the next step you can choose when you want to start the workflow as shown in the figure below.

Now your visual studio should look like the figure shown below

In the solution explorer there is one folder for Feature and one folder for Package. The package folder will hold the .wsp file when you package or deploy the project. Elements.xml: This file describes the workflow to SharePoint and it stores the name and description of the workflow, any forms that it uses, and other information.Workflow1.cs:These are the files that make up the activities and code for the workflow.
Now Drag and drop a CreateTask activity from the Toolbox to the Workflow designer, right below the onWorkflowActivated1 activity. There is a red mark in the activity which shows that we need to set a mandatory field in the workflow as shown in the figure below

Then go to the activity properties and give the corelationtoken.You have to use a unique correlation token for each task you are referencing in a workflow. And then expand the correlationtoken property and set the OwnerActivityName to Workflow1 as shown in the figure below

Now also the red mark removes. Then find the TaskID and click on ..., it will open the Bind dialog. The Bind dialog is used to link a workflow property to a field or property in the code-behind file. This can be either an existing member or you can choose to create a new one. Here Click Bind to a new member tab. Type “taskId” in the New member name textbox. Select Create Property radio button. Then click on OK as shown in the figure below

Next we need to do all these steps for TaskProperties property. In the next step double click on the CreateTask1 Activity ant will generate createTask1_MethodInvoking method. In this method, initialize taskId and taskProperties.
Here we will assign the task as shown below:
private void createTask1_MethodInvoking(object sender, EventArgs e)
taskId = Guid.NewGuid();
taskProperties = new SPWorkflowTaskProperties();
taskProperties.AssignedTo = "domainname\\username";
taskProperties.Title = "Task assigned from the sequential workflow";
After that F5 to deploy the web part, once the deployment finish go to the browser and click on the particular list. Click on the add new item and when you submit the form the breakpoint hits and when you will refresh a new item will be added to the list with name Task assigned from the sequential workflow.

Thursday, November 17, 2011

iFilter for AutoCAD DWG files

PDF ifilter configuration for MOSS 2007

configure pdf ifilter x64 SharePoint 2010

  • Install Windows Server 2008 following the SharePoint prerequisites (Pre-upgrade utility).
  • Install SharePoint 2010 with the complete option and run the PSconfig wizard. 
  • Configure required Server Farm Topology. In this example we use a Single Server Farm. 
  • Create a new Search Service application. 
Configure Adobe iFilter based on steps mentioned below:

  1. Install PDF iFilter 9.0 (64 bit) from
  2. Download PDF icon picture from Adobe web site and copy to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\ 
  3. Add the following entry in docIcon.xml file, which can be found at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML
    <Mapping Key="pdf" Value="pdf16.gif" />
  4. Add pdf file type on the File Type page under Search Service Application
  5. Open regedit
  6. Navigate to the following location:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension
  7. Right-click > Click New > Key to create a new key for .pdf
  8. Add the following GUID in the default value
  • Restart the SharePoint Server Search 14
  • Reboot the SharePoint servers in Farm
  • Create a Test site (with any out-of-box site template) and create a document library upload any sample PDF document(s).
  • Perform FULL Crawl to get search result.
Once the crawl is completed we will get search results.

NOTE: If this is a SharePoint Foundation 2010 environment additional steps will be required instead of step 4 above

Adding Searchable File Types to SharePoint Foundation 2010

PDF ifilter download link for x64 systems

Inplace Vs Gradual Upgrade SPS 2003 to MOSS 2007

In-place upgrade-:
An in-place upgrade takes place on the same hardware as your previous version installation. When you run an in-place upgrade, the process upgrades your entire installation in a pre-set sequence.

Gradual upgrade-:
Similar to an in-place upgrade, a gradual upgrade takes place on the same hardware that is used for your previous version installation. However, a gradual upgrade allows you to control when upgrade takes place for each individual site collection, and it also allows you to continue running the previous version and the new version side by side on that hardware. When you perform a gradual upgrade, the starting and ending topologies have the same configuration, similar to an in-place upgrade except for the following differences:
  • During and after upgrade, the front-end Web servers run both Windows SharePoint Services 2.0 and Windows SharePoint Services 3.0. Any upgraded site collections run under Windows SharePoint Services 3.0, whereas site collections that could not be upgraded or that were not selected for upgrade continue to run under Windows SharePoint Services 2.0.
  • During and after upgrade, both the Windows SharePoint Services 2.0 and the Windows SharePoint Services 3.0 databases are available. Content for upgraded sites is stored in the Windows SharePoint Services 3.0 databases; content for sites that could not be upgraded or that need to remain as they were continue to be stored in the Windows SharePoint Services 2.0 databases. Configuration databases exist for both Windows SharePoint Services 3.0 and Windows SharePoint Services 2.0.

In-Place Vs Gradual-:
I personally prefer gradual upgrade over in-place because of many reasons, out of which few are listed below...
  • Time saving-: gradual upgrade will allow you to see the upgrade and roll back if you need to. where as in case of in-place you will required to reinstall the version of sharepoint that needs to be migrated if something goes wrong while installation.
  • Reduced downtime-: Any mistakes (such as forgetting to run prescan.exe) or failures (running out of disk space) could result in extended downtime or expense.
  • Both versions of SharePoint will run in parallel on the same machine on different ports.
  • In-place more complex than gradual-: With my experience I found that in-place was more complex as against the recommendation from Microsoft.
Few recommendations-:
  • Prior to migration make sure all the webpart dll have been recompiled using framework 2.0 as MOSS runs on .net framework 2.0 and SPS 2003 runs on .net framework 1.1.
  • All html tag errors like unclosed tags should be fixed prior to migration else post migration you will see the file not found errors.
  • Plan for site upgrade in prior to migration for example-:site groups from SPS 2003 will become permission levels in MOSS 2007.
  • Extra considerations need to taken care if the migration is happening for 64 bit farms.

Last log entry not getting updated (User profile & properties)

Why this happens :

- Profmain.aspx calls importStatus.LastCrawlSeedStatus to determine if an error occurred during the last profile import.
- If the LastCrawlSeedStatus value is not 0, it checks importStatus.LastLogEntry and provides the text message from the log
- LastCrawlSeedStatus is a property of the content source People_Import (Hidden Content Source)

- If the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Applications\<GUID>\Gather\ProfileImport\ContentSources\0\StartPages\0

- Or if the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Applications\<GUID>\Gather\ProfileImport\ContentSources\1\StartPages\0

- If the value to anything other than 0, signifies the crawl error.
- The search account should have full control on this registry key
- The SSP account should have read access to this key.

How to Fix it :-

- Open the registry on the indexer server

- Checke the value of "lastCrawlSeedStatus" in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Applications\<GUID>\Gather\ProfileImport\ContentSources\0\StartPages\0

- And checke the value of "lastCrawlSeedStatus" in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Applications\<GUID>\Gather\ProfileImport\ContentSources\1\StartPages\0

- changed the value to 0
- Restart search service on Index server (better restart the server if you can due to too long waiting for stopping and starting the Office SharePoint Search Services)

All SharePoint Timer jobs stopped inspite of timer service running.

All SharePoint Timer jobs stopped inspite of timer service running.

One the causes which i have found is because of the SQL DB transaction logs getting full.

Best and low cost way of rectifying this is to schedule a sql job to shrink the log file on weekly/fortnightly basis.

Please find below the syntax for the same

DBCC SHRINKFILE("MyDatabase_Log", 1)
DBCC SHRINKFILE("MyDatabase_Log", 1)

Tuesday, November 8, 2011

Charul Bhargava- SharePoint Home

Welcome to my blog site. You will find everything related to SharePoint here in this blog.