Overview: Download the visual studio 2010 solution. This contains the code to implement the timesheet application within SharePoint 2010. The instructions give step by step actions to get the full timesheet application working.
Related posts in this series:
Part 1 - Design & data storage
Part 2 - Building the UI
Part 3 - Installation Steps (This blog post)
Part 4 - Final Part
Simple Instructions for Timesheet deployment
==================================
You require a web application that contains a site definition, I used a new web application (http://intranet.dev/) with a Publishing Site as the site template for the root site collection.
1. Download PaulB-Timesheet.wsp (save it to the server/local machine, I put PaulB-Timesheet.wsp on the e drive for this post)
2. Open Powershell with SharePoint commands:
3. Install the wsp and activate the feature using Powershell (PS) as shown below (text version of the PS commands)

4. Check the feature has been installed correctly on your site
5. Create a new database and popluate it with tables, download the SQL script.

6. Ensure the Timesheet database is created and ensure an account has permissions to access the table for read/write opterations.

7. Edit the web.config files on each Web Front End SP2010 Server (this should be changed to a feature receiver). The connection string below uses windows trusted and will pass through each users Windows identity, it will generally be easier to user a dedicated connection string account as it saves on SQL Server permions being required for each user.

To complete your setup you need to configure your timesheet application per part 4 - Seed data & page creation.
Summary:
This will be sufficient for most standard requirments however, it is preferable to implement logging to the ULS and your own logging mechanism if it exists.
The areas I would customise on a SharePoint custom deployment would be:
PaulBeck.Timesheet.zip (version 1 - 820 KB), unzip the files and place on you development machine.
1.> Build and deploy solution to SharePoint farm. The Visual Studio 2010 project has the following structure.
2.> Run the Script\timesheet-script.sql file in a SQL instance (Creates the db).
3.> Change the web.config to contain the app setting connection info for timesheets.
Configure your Timesheet Application
4.> Add the "Timesheet - Consultant", "Week", "Timesheet - UserProjects" & "Timesheet - BookTime" web parts to a new page.
5.> Connect "Timesheet - Consultant" to "Timesheet - Week" & "Timesheet - UserProjects", then connect "Timesheet - Week" to "Timesheet - BookTime" web part.
6.> Create another page called "Timesheet Add or Edit" i.e. "Timesheet-Add-or-Edit.aspx" (set in the web.config) and add the "Timesheet - BookTimeItem" web part to the page.
7.> Add the Admin screens by:
7.1.> Create a new page named "Timesheet Admin Main", add the following web part to the page "Admin Main".
7.2.> Create a new page named "Timesheet Admin Client", add the web part "Admin - Client" to the page.
7.3.> Create a new page named "Timesheet Admin Project", add the web part "Admin - Project" to the page.
7.4.> Create a new page named "Timesheet Admin Project Resources", add the web part "Admin Resource Allocation" to the page.
Part 1 - Design & data storage
Part 2 - Building the UI
Part 3 - Installation Steps (This blog post)
Part 4 - Final Part
Related posts in this series:
Part 1 - Design & data storage
Part 2 - Building the UI
Part 3 - Installation Steps (This blog post)
Part 4 - Final Part
Simple Instructions for Timesheet deployment
==================================
You require a web application that contains a site definition, I used a new web application (http://intranet.dev/) with a Publishing Site as the site template for the root site collection.
1. Download PaulB-Timesheet.wsp (save it to the server/local machine, I put PaulB-Timesheet.wsp on the e drive for this post)
2. Open Powershell with SharePoint commands:
3. Install the wsp and activate the feature using Powershell (PS) as shown below (text version of the PS commands)

4. Check the feature has been installed correctly on your site

5. Create a new database and popluate it with tables, download the SQL script.

6. Ensure the Timesheet database is created and ensure an account has permissions to access the table for read/write opterations.

7. Edit the web.config files on each Web Front End SP2010 Server (this should be changed to a feature receiver). The connection string below uses windows trusted and will pass through each users Windows identity, it will generally be easier to user a dedicated connection string account as it saves on SQL Server permions being required for each user.

To complete your setup you need to configure your timesheet application per part 4 - Seed data & page creation.
Summary:
This will be sufficient for most standard requirments however, it is preferable to implement logging to the ULS and your own logging mechanism if it exists.
The areas I would customise on a SharePoint custom deployment would be:
- Assemly and wsp solution naming;
- Add logging to error handling;
- Rename lables;
- Potentially add custom fields or logic to the application to meet specific business requirements.
Instructions for Timesheet deployment using Visual Studio 2010 (Advanced option)
===============================================
Download the Visual Studio 2010 project:PaulBeck.Timesheet.zip (version 1 - 820 KB), unzip the files and place on you development machine.
1.> Build and deploy solution to SharePoint farm. The Visual Studio 2010 project has the following structure.
2.> Run the Script\timesheet-script.sql file in a SQL instance (Creates the db).
3.> Change the web.config to contain the app setting connection info for timesheets.
Configure your Timesheet Application
4.> Add the "Timesheet - Consultant", "Week", "Timesheet - UserProjects" & "Timesheet - BookTime" web parts to a new page.
5.> Connect "Timesheet - Consultant" to "Timesheet - Week" & "Timesheet - UserProjects", then connect "Timesheet - Week" to "Timesheet - BookTime" web part.
6.> Create another page called "Timesheet Add or Edit" i.e. "Timesheet-Add-or-Edit.aspx" (set in the web.config) and add the "Timesheet - BookTimeItem" web part to the page.
7.> Add the Admin screens by:
7.1.> Create a new page named "Timesheet Admin Main", add the following web part to the page "Admin Main".
7.2.> Create a new page named "Timesheet Admin Client", add the web part "Admin - Client" to the page.
7.3.> Create a new page named "Timesheet Admin Project", add the web part "Admin - Project" to the page.
7.4.> Create a new page named "Timesheet Admin Project Resources", add the web part "Admin Resource Allocation" to the page.
Part 1 - Design & data storage
Part 2 - Building the UI
Part 3 - Installation Steps (This blog post)
Part 4 - Final Part


22 comments:
Hi Paul - nice solutions, do you have any more information about how to add extra fields.
You need to peform the following actions to add/ammend additional fields:
1.> Edit the timesheet database;
2.> Regenerate the LINQ to SQL classes (done via VS by selecting the item template)
3.> Ammend the UI (web parts)
4.> Rebuild and deploy the solution (wsp)
Hi Paul,
I've deployed your solution on my server, but the timesheet-add-or-edit.aspx page gives errors. Also when i go to the timesheets page, i can't see any users, or select one. Creating clients and project is going fine, but the other things gives errors. Do you have a hint for me, thanks in advance. Greetings George.
Hi George thanks for the feedback. What error are you getting on the timesheet-add-or-edit.aspx? If you could provide the steps you do to get the error and the error message I should be able to help you.
It's weird that some functions work but not others. Only thing I can guess at is you don't have the correct seed data? Check you have resources and they are assigned to projects? Kind of guessing here but you error message will give me more info.
thanks
paul
Hi Paul,
I've solved the problems, i needed resources. The person who is reviewing, should also be connected to the project. It is working fine now. I'm now trying to create a planning tool based on this, then it is complete. Time registration and planning combined. Greetings George.
@George: Glad you worked this out. Drop me some info with your findings of adding the planning functionality if you get a chance.
Hi Paul
could this timesheet be used to pull specific "data" from TFS2010?
Thanks Andy
Hi Andy,
It would be a sixable change to grab TFS users data and prepopulate the timesheet application, but it is possible. The hardest task would be gettting the users TFS time data, see
http://archive.msdn.microsoft.com/TfsSdk/
http://blogs.msdn.com/b/granth/archive/2010/01/12/tfs2010-invoking-tfs-web-services-using-powershell.aspx
paul
"7. Edit the web.config files on each Web Front End SP2010 Server (this should be changed to a feature receiver). The connection string below uses windows trusted and will pass through each users Windows identity, it will generally be easier to user a dedicated connection string account as it saves on SQL Server permions being required for each user."
Kinda new to sharepoint and am trying to get this to work I dont understand point 7 I see a couple of web.config files on the front end which one are you saying to edit?
The web.config you are interested in is the one under IIS 7.
Open IIS find your web application > Explorer (Windows Explorer) and this is your web.config, I think hte default is c:\inetpub\wss\youapp.
If you have any issues getting this step to work send me you web.config connection string entry and any related issue.
Hope that clears up thie step for you.
Hi Paul,
If I understand your application correctly, this is an ASP.NET and SQL Server Application. Other than deploying the ASP.NET as a WSP, you are not using the data facilities of SharePoint 2010 at all.
Why did you select this method rather than using SharePoint lists to store your data?
If you look at the database entity relationship diagram (ERD) you will see 7 tables. SharePoint lists and queries using CAML are not great at querrying multiple tables. Additionally, transactions are not supported when using SharePoint as your data storage.
Due to the nature of the application, SQL server makes a better storage candidate over SharEpoint lists.
You can use SharEPoint lists and use LINQ to SharePoint, it will still work with minimal changes.
Hi Paul,
I am new to this environment.Please help me ,I am using the WSP here .Every thing went on fine till step 7. i am struck at step 7 (near Web config file).You want e to add the above statements in the tag.
Its givn as (To complete your setup you need to configure your timesheet application per part 4 - Seed data & page creation.)
please guide me where do i get this stuff.
once more doubt how will i be able to start using the application.
Please provide me the information of the above requested.
Thanks In Advance,
Regards,
Subha
Hi Subha,
To implement this solution you will need to have some understanding of SharePoint. Changing the web.configs is something a .net developer or a SharePoint admin can help you with. The timesheet is not a supported production application for SharePoint and the source code can be ammended to suit your business need.
I will need specific instructions if you want help, as I can't follow your comment.
I get following error when i build and deploy the zip through Visual Studio Can u suggest me solution for this
Error occurred in deployment step 'Recycle IIS Application Pool': The vssphost4.exe process was unable to start due to an unknown error or problem.
Hi Amol,
Check if the VSSPHOST4 service is running?
Also try:
Close and open VS2010.
a reboot on your dev machine?
Hi,
When i add the book time item i got the error
of "Sequence contains no elements".how to solve this.
Hi Vijay,
The error means that you are tryin to work with a seqence of element but you don't have 1.
To Fix: Debugthe code in VS and use appropriate logic to stop the error or trap the error. This won't occur if you have seed data and the web parts are correctly linked.
Have a look at:
http://msmvps.com/blogs/kevinmcneish/archive/2009/12/17/fixing-linq-error-sequence-contains-no-elements.aspx
http://techbrij.com/827/sequence-contains-no-elements-linq-lambda-error
hi paul beck
thanks for share such nice code and step to impliment it.
need help on step you had mentioned about
5.> Connect "Consultant" to "Week" & "UserProjects", then connect "Week" to "BookTime" web part.
how this is done. not able to find way to connect it .
Hi Ram,
On the page containing the web parts, in edit mode (edit page), if you click on the arrow drop down on the web part, you will see the option for connections. Hook the appropriate connection up.
Hi Paul,
Very nice solution. Keep on going!
Paul,
I stuck at Step: 7. Some how not able to locate web.config file. Could you please help me the location for the same & area where I need to make changes.
I have Sharepoint Foundation 2010.
Sachin
E:mail: sachinsant@sungrace-group.com
Post a Comment