Monday, September 9, 2013

SharePoint Design Patterns

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. [ Wikipedia]

In .NET development, there are many design patterns that we use. However with SharePoint all of them might not useful. But Microsoft has recommend following design patterns for SharePoint Development.

  • The SharePoint Service Locator
  • Mode-View-Presenter (MVP)
  • Repository


I have just started reading about those and will write down here as soon as I have mode hand's on with them.

Tuesday, November 18, 2008

HOW TO : INFOPATH FORMS DEPLOYMENT, SHAREPOINT WORKFLOW IN VS 2008

INFOPATH FORMS DEPLOYMENT, SHAREPOINT WORKFLOW IN VS 2008
A number of developers who have tried the SharePoint workflow features in VS 2008 wanted to know more about our support for InfoPath forms deployment. So I'm blogging it here for everyone's reference.

Before diving into details of InfoPath forms deployment here's a little bit of background on workflow and InfoPath forms integration. Typical SharePoint workflows goes through different stages - association, initiation, task completion. Also, workflows might be modified after being initiated. SharePoint supports ASP.NET and InfoPath forms to enable developers to capture user inputs at these different stages. For example, on initiation of a simple document approval workflow you might want to capture the approvers for the document.

To develop InfoPath forms you can either use the VSTO template for InfoPath that also ships with Visual Studio 2008 or InfoPath (with VSTA) itself. Once you have designed the InfoPath form it can be published as an XSN file. There is some great documentation on MSDN regarding this. In general, if you need code (custom event handlers/validation) behind your InfoPath forms you should use the VSTO InfoPath template and create a project alongside your workflow project.

Coming back to SharePoint workflow integration with InfoPath forms - It is very easy to deploy InfoPath forms along with your workflow. All you have to do is to add a relative reference to the form in the feature.xml with the element eg:

When you press F5 you will see that VS will copy the form alongside your feature.xml files in the 12\TEMPLATE\FEATURES\\ directory. It must be noted that this is a relative reference to the form and VS will look in the path specified relative to the source location of feature.xml.

You can use the above feature to also install resx files or any other accompanying files. Also, the feature.xml file is processed by SharePoint on feature installation and absolute paths or relative references with ellipsis are not supported (for obvious security reasons). However, you can add references that need to be deployed as subdirectories and we will replicate the hierarchy eg:


On F5, a subdirectory named InfoPathForms  will be created in the 12\TEMPLATE\Features\\ directory.

And yeah, don't forget to reference them also in the workflow.xml as an initiation, association, modification or task form, to see them show up at runtime.

Now go ahead and have fun with InfoPath forms!

MOSS 64 Bit damm. Not Good for Development

I installed MOSS 64 bit on Windows Server 2008 for development. But it not good at all. I can do nothing. Now I'm on the way to reinstall MOSS 32 bit on their. If you are willing to do development then don't install MOSS 64 bit.

Monday, November 17, 2008

The names and the IP addresses of client computers are not logged when you enable auditing for a site collection in Windows SharePoint Services 3.0


When you view the audit reports, you do not see any information logged about the names or the IP addresses of client computers that accessed the site collection.
When you view the AuditData table in the content database of the Web application, the values in the MachineIP column and in the MachineName column appear as NULL.

Reason for that is :

"The values in the MachineIP column and in the MachineName column appear as NULL because of privacy concerns. By design, Windows SharePoint Services 3.0 works in this manner."

Note : I don't know why they giving those feature when it disable.


http://support.microsoft.com/kb/939246

Wednesday, October 29, 2008

How to use SharePoint Workflow UpdateTask

Update task activity in SharePoint workflow use to update task without getting locked. But there is a issue when changing task user for the task item.

In order to Update Task, follow these steps:

Follow below settings for UpdateTask Activity:

  • Correlation Token: Same as of Create Task activity
  • Task ID: Same as of Create Task activity

Insert a Code Activity before Update Task activity.

In Code Activity, write below code:

Code Snippet

updateTask.TaskProperties.AssignedTo = @"domain\username";

Note : This is for the change task user (Approver)

Monday, October 27, 2008

Adding Navigation to ECB as Feature

Adding Navigation to Document Library Menu.

There are number of scenarios that you have to link document library item to custom application page with the list id and the item id. There are two option that have for this.

1. Adding Content Query Web Part ( now i cannot remember how to do this)
2. Adding feature as Custom Action to the ECB.

im going to discuss about how to do it using feature.

In here im writing element.xml it is up to you define the feature and the activate it inside the farm.


<customaction id="MyApplication.ECBItemMenu"
registrationtype="List"
registrationid="101"
location="EditControlBlock"
sequence="105"
title="MyApp Page">

<urlaction url="~site/_layouts/CustomApplicationPages/ApplicationPage4.aspx ?ItemId={ItemId}&ListId={ListId}">
</urlaction>

</customaction>


But this ECB menu will appier only to the document library items. If you need this add to list item, you have to extend this using "Item" content type id. This figure show you content type ids for the base content types in the SharePoint. What you have do is change your "registrationtype" and "registrationid".




This will add this ECB menu to your custom list.


<customaction id="MyApplication.ECBItemMenu"
registrationtype="ContentType"
registrationid="0x010"
location="EditControlBlock"
sequence="105"
title="MyApp Page">

<urlaction url="~site/_layouts/CustomApplicationPages/ApplicationPage4.aspx ?ItemId={ItemId}&ListId={ListId}">
</urlaction>
</customaction>


This are the examples of them


We can add ECB menu to the Dislpay, Edit item form also.

Sunday, October 12, 2008

Create Custom Site Definition for SharePoint with Custom MasterPage

There are situations in SharePoint World we have to use same customized master page for every SharePoint site in the organization. Customizing master page using SharePoint designer is take time and its too hard to maintain. As a solution for the you can introduce new SharePoint Site Definition for your organization. Using that you will be able to use same look and feel for each and every site that you going to create for your organization.

(Visual Studio 2008 extensions for Windows SharePoint Services 3.0 (version 1.2)




Then open wsp view of the solution. If wsp view not visible in the project you can open it from View à Other Windows à WSP View (CTRL+W,I)


Then open webtemp.xml (webtempMyCustomDefinition.xml)


Then change it titel as relevent ( this step is not nessasry )



Now you are ready to deploy your solution.


Deploy your solution using Visual Studio.


Chake follwing folders after complte deploymet


“MyCustomDefinition” at

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\


webtempMyCustomDefinition.xml file at

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML


Make sure to IISRESET

Now you are ready to create new web site using new custom site definition.

Change Deployment tab in template selection .