Wednesday, April 20, 2011

Workflows do not start in SharePoint

You are of course aware of the fact that starting with Service Pack 1 the workflows created in SharePoint designer that should launch under the credentials of the system account will no longer start automatically.




You know what the resolution is for this problem: simply do not to use the system account.



You implemented all the steps written here http://support.microsoft.com/kb/947284 ,but the workflow still does not start.



More interesting, if you email-enable a document library and attach a workflow to it, and set the workflow to start on Item creation, this workflow will never start.



This usually happens because the e-mail is saved into the document library using the sharepoint services timer service account credentials. If an e-mail was created by the system account then the workflow will attempt to start using the system account which is no longer permitted.



As you cannot change the credentials for the for the timer service, what should you do?



The answer is pretty simple: install Infrastructure Update http://support.microsoft.com/kb/953749/(and of course if you are at it, you can update the whole farm to the latest patch level (FEB CU) ) and pay close attention to one small line (made bigger here because of it’s importance) written in the notes part of the knowledgebase article:



To prevent the declarative workflows from impersonating the system account, the workflows will now impersonate the user who created the workflow association.



This basically means that you should create a special account not SHAREPOINT\SYSTEM, that is a site collection owner on the site collection where the workflow is hosted, open the workflow in SharePoint Designer while logged on as this new account and simply save the workflow without modifying anything.



It will effectively change the account that associated the workflow, which will allow it to start.



A !



you should also run



stsadm -o setproperty -pn declarativeworkflowautostartonemailenabled -pv true



to enable workflows to start using the impersonation scheme



Monday, May 17, 2010

Differences between site definition and site templates

Site Template
The first option for getting the SharePoint Designer changes beyond the current site is to take the site you've modified with SharePoint designer and save it as a template. Then when you need a new site you create it from the site template you've created. This approach works but it means that you either have to create a new site template for each of the built in site definitions -- or you have to live with just the one site template that you've created. It also means that you can't go back and apply the changes after they've been created.Finally, to add insult to injury, if you ever change the work that you did on the original site those changes won't be reflected across the other SharePoint sites that were created from the template because each page exists separately in the database. So site templates solve the problem of getting SharePoint Designer changes into multiple sites but without the ability to adapt to changes in the future.
Site Definitions
solve the problem of site templates in that changes can be affected to them after they've been created -- but at the cost of additional work. Site definitions exist on the file system of each of the front end web server unlike site templates which exist in the content database. Each site which is created from the site definition doesn't make a copy of the page in the database, instead it stores a pointer to the site definition file. The good news is that when the page on the file system changes it changes all of the references in the database -- thus solving the problem of making changes to existing branding.In order to do a site definition, you'll first have to get the changes to the files that you want into files. You can do this from SharePoint Designer by selecting Save As and pointing to a directory. From there you have to create the support files for the site definition including the ONET.XML file which drives how the site definition is used, and the WEBTEMP*.XML file which makes the site definition show up as an option. In most cases you'll copy the STS site definition that comes with SharePoint and make your changes there rather than starting from scratch.

Pros and Cons of Site Definitions and Site Templates.
Customization of site definitions holds the following advantages over custom templates:
-Data is stored directly on the Web servers, so performance is typically better.
-A higher level of list customization is possible through direct editing of a SCHEMA.XML file.
-Certain kinds of customization to sites or lists require use of site definitions, such as introducing -new file types, defining view styles, or modifying the drop-down Edit menu.
Site definition disadvantages include the following:
-Customization of site definition requires more effort than creating custom templates.
-It is difficult to edit a site definition after it has been deployed.
-Doing anything other than adding code can break existing sites.
-Users cannot apply a SharePoint theme through a site definition.
-Users cannot create two lists of the same type with different default content.
-Customizing site definitions requires access to the file system of the front-end Web server.
-Custom templates hold the following advantages over customization of site definitions:
-Custom templates are easy to create.
-Almost anything that can be done in the user interface can be preserved in the template.
-Custom templates can be modified without affecting existing sites that have been created from the templates.
-Custom templates are easy to deploy.
Custom template disadvantages include the following:
-Custom templates are not created in a development environment.
-They are less efficient in large-scale environments.
-If the site definition on which the custom template is based does not exist on the front-end server or servers, the custom template will not work.