Friday, October 30, 2009

Sharepoint Workflows / ASP.NET - Logging using diagnostic traceing

One of the coolest feature in asp.net is its tracing. Good thing is that it can be utilized in sharepoint as well and provide an easy way for logging inside workflow foundation.
You just need to add following in you sharepoint web.config file

<system.diagnostics>
<switches>
<add name="System.Workflow LogToTraceListeners" value="1" />
<add name="System.Workflow.Runtime.Hosting" value="Verbose" />
<add name="System.Workflow.Runtime" value="Verbose" />
<add name="System.Workflow.Runtime.Tracking" value="Verbose" />
<add name="System.Workflow.Activities" value="Verbose" />
<add name="System.Workflow.Activities.Rules" value="Verbose" />
<add name="[Your namespace]" value="Verbose" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Output.log" />
</listeners>
</trace>
</system.diagnostics>

and use following command in your code for sending log to your file for your logging

System.Diagnostics.Trace.WriteLine([message])

Thursday, October 29, 2009

Lotus Notes Email search - Searching Email to Notes client

When configuring lotus notes content source with sharepoint server you will noticed that search results return urls for lotus notes document. These URL transfer controls to lotus notes web access so that user can access his search email and look at its content.

There are few scenarios when user will not like to use webaccess and would like to open searched emails in lotus clients.

1 - Intranet Environment when all users accessing sites have lotus client installed.
2 - Company policy to restrict web access to all users.

Following are step for configuring sharepoint to display Lotus notes document URLs to Lotus notes client instead of lotus notes web access.

1. Goto shared service provider.
2. click search settings.
3. click server name mapping.
4. Add new mapping with following details
a. Address in index : http://[Lotus server name]
b. Address in search result : notes://[Lotus server name]

Please notes that lotus notes client will be required on all end user machine for opening emails.

Tuesday, October 27, 2009

Configuring sharepoint search to crawl lotus notes emails and database

Recently I was assigned with an assignment to integrate/configure moss so that it can crawl the lotus notes database and provide search mechanism to moss users. Following are some really really useful links for that

Following links on tech net are helpful for achieving the 90% of functionality.
http://technet.microsoft.com/en-us/library/cc262927.aspx
http://technet.microsoft.com/en-us/library/cc261820.aspx

The trickiest part of solution is to select the correct field of person view in creation of notes mapping database. As that information is not clear in above technet article.
Creation of mapping table and setting/picking up lotus id (using owner field of person view) is well defined in following POC.

http://blogs.msdn.com/edhild/articles/473060.aspx

Another trickiest part that I face was that you need to explicitly assign default security setting to reader by clicking document properties of security mapping views.

I have tested that lotus protocol handler is working fine with
Lotus 6.0 client
Lotus 7.0 client
and Lotus 8.5 client

I have tested this with following domino server
Domino 7.0
Domino 8.5

An interseting thing was that even I managed to integrate it properly but face strange errors in adding notes content sources using moss UI (using SSP).

I downloaded search admin utility from following link to add content and it worked great for me
http://www.codeplex.com/searchadmin

Another added feature of above utility that I discovered later is that it allow assigning multiple domino database as a single content source. Which remove that restriction of enabling search on maximum of 500 notes databases. so if you use standard database for adding content database you will not be able to search more than 500 notes database. But this utility will allow searching on 500X500 databases

Sunday, October 25, 2009

Sharepoint 2007 - Tracing if variation crashes

Sharepoint system will not provide any alert or notification to user if any thing crashes in varaition system.
e.g. If any issue occurs it will not copy pages but you will be noticed that later when you will find broken links on your site.

It is recomended that administrator checks logs after publishing new contents to see if everything working as per expectation. Varaition logs can be location in site settings at your top level site.

If you think you are getting unexpected behaviour and your logs are not showing any useful information you may further investigate logs in "hive 12" i.e. "[Program Files]\Common Files\Microsoft Shared\web server extensions\12". You may check status of your scheduled job for locating any issues in variation. If you found that issue is due to execution of your job restart Windows sharepoint timer service using services console "services.msc" to fix issue.

Wednesday, October 21, 2009

Sharepoint - Issues with language selection in using MOSS variations

While working with MOSS varaitions you may noticed that you will not find any mechnasim for switchin youg language i.e Language selection will be missing on you page. This is bacuse the language selection is disabled by default.

For enabling language selection you need uncomment a line in VariationsLabelMenu.ascx mnually. It can be located at "[Program Files]\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\" folder.

you have to uncomment line for language selection in "VariationsLabelMenu.ascx" to enable language selection on your MOSS site

Monday, October 19, 2009

Sharepoint 2007 (MOSS) - Multilingual Implementation issues using variations

Microsoft Sharepoint Server 2007 (MOSS) provides multiplingual functionalities using its language pakages and variations. When proper language packages are installed you can use power of variation to build multiligual side.

The way variation is designed, It provide you alot but you still need to think on several points and issues while designing your site structure using MOSS Varaition.

Variation simply copy pages from one site to another and provide you functionality to maintain two copies of sites but sharepoint list and other structures remains in master site and will give you un anticipated behaviour.

When you create variation label it will create sites with in your varaition root with selected local and sharepoint will set culture of site.

Following are the problem that you may need to think on while woking with mutlilingual sites that provides more then content publishing.

1. Deployment of custom workflows.

Workflows associated with lists in sharepoint, when you design any custom workflow it will be binded with either a list in English site or Other Language site. so out come of workflows will be in one language and lot of custom components will be required in order to support it.
If you use out of box workflows, the porblem remain same.
So you need to be very carefully in placing your sharepoint lists in multilingual environment.

2. Deployment of sharepoint Content except pages.

If you deploy any out of box feature that will be deployed in sites separately. i.e. If you are thinking of deploying surveys the surveys will be deployed separately on each language site and will not have any association. Say we have two sites in English and French then survey list needs to be created separately in both sites. These will be totally in dependent you need to create survey in both language manually and out of box functionality doenst provide any mechanism to show result.
The similar behavior will be noticed in all othey contents and one needs to be very careful while designing shepoint multi lingual sites

Sunday, October 18, 2009

Sharepoint Web Control - Validating date time control (SPDateTimeControl with validators)

When working with Sharepoint Controls you may experience different behavior sometime as anticipated with any other controls library. I was thinking of doing some date validation and found some interesting fact with SPDateTime Control.

Few were not relevant to me so I didnt looked up them but I need to put required field validator for my mandatory field. I noticed that required field validator included in libaray was not working. After looking at member properties I found that there are properties included in controls for handling this

1. IsRequiredField
2. ErrorMessage

I used above fields and it worked for me nicely. The second task was to control invlaid dates entry from user. I thought it would be built in in the control and my guess was right with some exception. Sharepoint was handling this but for some reason it was not controlled at client side. I checked SPDateTimeControl.IsValid at server side and it worked for me.

Though it was working on server side I decided to stop false entry at client side for better GUI. I placed regular expression validator but it was not workin again. I did some research and find a soloution fo it i.e in ControlToValidate property place [ControlName]$[ControlName]Date instead of control name and it will solve issue

Wednesday, October 7, 2009

Starting child sharepoint workflow from a custom parent workflow

In case you need to encounter a case when you want to run child work flow from you parent share point work flow the obvious option would be the invoke Work flow activity.

It is out of box and run asynchronously naturally same goes in my mind. I tried it in my parent work flow and result was very strange. Invoke work flow activity works fine but none of the child flow get started.

I tried debugging and found several errors generated by work flow runtime few of them are mentioned below

System.Workflow.Runtime Information: 0 : CorrelationToken Uninitialized for owner activity
System.Workflow.Runtime Information: 0 : CorrelationToken Uninitialized for owner activity
System.Workflow.Runtime Critical: 0 : Uncaught exception escaped to the root of the workflow.
In instance in activity
Inner exception: System.Workflow.Runtime.Hosting.PersistenceException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.SaveWorkflowInstanceState(Activity instanceState, Boolean unlock)
at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
--- End of inner exception stack trace ---
at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
at System.Workflow.Runtime.WorkflowExecutor.ProtectedPersist(Boolean unlock)

I did lot of searching on and find an interesting article (http://www.sharepointnutsandbolts.com/2008/02/invokeworkflow-child-workflows-not.html) that help to to divert my attention to other workarounds

Now I start believing that invokeWorkflow will not work for me and looked for alternative and find an easy way to activate flow using Code Activity.

I simply write following code and luckily it did the same job as was expected.

SPWorkflowAssociationCollection associationCol = this.workflowProperties.List.WorkflowAssociations;
foreach( SPWorkflowAssociation association in associationCol )
{
if( association.BaseId.Equals(new Guid( "" ) ) )
{
this.workflowProperties.Site.WorkflowManager.StartWorkflow( workflowProperties.Item, association, "", true );
break;
}
}

I hope this post will help other user to find solution quickly.