Wednesday 19 January 2011

Timesheet solution for SharePoint 2010 - Part 4 Application setup guide

Part 1 - Design & data storage 
Part 2 - Building the UI
Part 3 - Installation Steps
Part 4 - Final Part (This blog post)

Overview: Once the Timesheet wasp is installed, the new Timesheet database and the web.config changes have been made as described in Part 3 (Timesheet Installation), you need to add pages for users to input there timesheets and administration.  You will need to create at least 1 client, 1 project and add a person to a project before you can submit timesheets. 

Add pages to the Timesheet application within SharePoint 2010:
I create a "new publishing site" called "Timesheet" with the following url http://intranet.dev/timesheets/Pages/default.aspx.
I then added the following web parts to the page:
All the web parts are connected web parts (To connect the web parts, when the page is in edit mode,click the button to edit).
Create the popup page that is linked to on the page just created.
Ensure that the "New task" & Edit task links are working.
Create a new Administrators page, add the "Admin - Main" web part to the page.
Check the following 3 web.config settings and create the appropriate pages, each page has 1 web part as shown below.
Ensure all the popups work from the main administration page.

Part 1 - Design & data storage 
Part 2 - Building the UI
Part 3 - Installation Steps
Part 4 - Final Part (This blog post)

68 comments:

Paul Beck said...
This comment has been removed by the author.
Unknown said...

Hello Paul,

I have been looking at coming up with a solution like this, you just saves tons of work.

You are the man.

Paul Beck said...

Hi Shola, Glad it helps you. Let me know how you get on. paul

AnĂ´nimo said...

Can i deploy directly from VS????

Paul Beck said...

Hi Tiago, I need more detail, what do you want to deploy directly from VS?
The WSP's? Yes, but you shouldn't us VS on production.

AnĂ´nimo said...

There are missing some resources like Consultant Form and Week form.

This solution is very good but i'm having some dificulties to deploy it.

I have deployed from VS directly to SP production env.

I'm also experiecing some trouble with Ribbon error on log of app of sharepoint.

05/11/2011 16:19:13.56 w3wp.exe (0x15EC) 0x16B0 SharePoint Foundation Runtime tkau Unexpected System.ArgumentException: The Ribbon Tab with id: "Ribbon.Read" has not been made available for this page or does not exist. Use Ribbon.MakeTabAvailable(). em Microsoft.Web.CommandUI.Ribbon.Render(HtmlTextWriter writer) em Microsoft.SharePoint.WebControls.SPRibbon.Render(HtmlTextWriter writer) em System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) em System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) em System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) em System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) em System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) em System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlText... dae9730c-267f-46f7-b6ad-d67ece86d1a

Anonymous said...

I have followed all of your steps, but continue to have a problem. The second I add the BookTimeItem webpart, I receive the Error popup.

An unexpected error has occurred.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: 9f264e75-c43a-46e5-8f42-d582af50b58e

Any help would be greatly appreciated.

Thanks,
Nestor

Paul Beck said...

Hi Nestor,

You need to open you ULS logs (or use ULS viewer) in notepad. Find the correlationid that you have posted, then send me the log. This will give you an indication of what the issue is with the BookTimeItem web part.

Pls ensure you have the appropriate read/write permissions on the database for the IIS app pool account. If your other web parts are working (getting data from SQL) than this is not your issue.

Let me know what your uls log says and if you find a resolution.

thanks
paul

Anonymous said...

Hi Paul,

Thanks for the quick response. The initial problem was permission, but I sorted that out by creating a specific user and modifying the web.config. However, I'm still getting an error with the BookTimeItem part.

I've narrowed it down to these lines in the ULS log.

08/12/2011 14:41:31.32 w3wp.exe (0x144C) 0x0F2C SharePoint Foundation Runtime tkau Unexpected System.InvalidOperationException: Sequence contains no elements at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression) at System.Linq.Queryable.Single[TSource](IQueryable`1 source) at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItemUserCon... 9d8a3541-45ef-4440-be5e-69ccf53863ce
08/12/2011 14:41:31.32* w3wp.exe (0x144C) 0x0F2C SharePoint Foundation Runtime tkau Unexpected ...trol.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.AddedControl(Control control, Int32 index) at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItem.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.Pre... 9d8a3541-45ef-4440-be5e-69ccf53863ce
08/12/2011 14:41:31.32* w3wp.exe (0x144C) 0x0F2C SharePoint Foundation Runtime tkau Unexpected ...RenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 9d8a3541-45ef-4440-be5e-69ccf53863ce

Thanks again for all the help.

Nestor

Anonymous said...

hi paulb

i also have the same problem:
I have followed all of your steps, but continue to have a problem. The second I add the BookTimeItem webpart, I receive the Error popup.

An unexpected error has occurred.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.

i've done everything that you stated above, but nothing seems working,
please help out.

thanks

Anonymous said...

same problem Paul, please help out with that second webpart BookTimeItem.

Paul Beck said...

You will need to debug the code to find the error. I'm not sure what the issue is can you send me the ULS logs (only the problem messages)? thanks paul

Anonymous said...

The error message: from the ULS Logs

System.InvalidOperationException: Sequence contains no elements
at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.Single[TSource](IQueryable`1 source)
at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItemUserControl.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItem.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Anonymous said...

This error appears, when i modify the BookTimeItem acsx.cs;
when I add OrDefault to .Single

System.NullReferenceException: Object reference not set to an instance of an object.
at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItemUserControl.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItem.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Paul Beck said...

You don't have the required seed data inside the SQL Server database, check that the appropriate data is in all the tables.

http://blogs.msdn.com/b/jongallant/archive/2007/12/02/linq-sequence-contains-no-elements-invalidoperationexception-when-calling-single.aspx

This is a bug, I should of checked for this condition in my code. Please ammend the code to check data exists. and you do need the seed data in the db. Appologies - paul

Anonymous said...

Hello Paul,
I am having the same problem with the webpart BookTimeItem. You describe having the proper seed data in the tables. Can you provide some additional deatail. I have put some dumby data into those table from SQL Manager but it has not changed the result.
Any help is much appreciated.
Thank you,
Craig

Paul Beck said...

Hi Craig,

Please check that you have data in all the tables and that it has correct keys.

I have tracked this and it's abug in the code, so you can either debug the code and simply ammend the LINK method from .Single() to .SingleDefault(). Or put a try catch block around this code.

It simply is trying to work with data that doesn't exist. Hope that helps

paul

Anonymous said...

Hello Paul,
Thank you. That was partly the problem. I purged the tables and repopulated them with new data, making sure to pay attention to all the keyIDs and have the main screens working. This would be the TimeSheet and the Adminstrator screens.

However, I still have a snag on the launching of the popup screens from the javascripts like getDDLClient, getDDLProject, OpenDialogAdr, etc.

All of the popup screen have an Error. There is Correlation ID: but I have not been able to find the that it is writting to the log file into log files in .../Web Server Extension/14/LOGS. I have to appologize. I am not a Sharepoint Developer so I may need extra explaination.

I am suspecting that there is a path issue (myurl) in the Javascripts that is causing this problem. Can you guide me as to where this can be corrected? Thank you in advance.
Craig

Anonymous said...

Hi Paul,

I'm having an issue with your code. I'm tracked down the problem: when opening up a ModalDialog, the querystring attached to the url has ampersands. These ampersands don't get escaped for some reason and as a result, Sharepoint chokes on it. I tried hardcoding escapes in, but for a dialog, Sharepoint appends &IsDlg=1. The url doesn't escape it and so Sharepoint chokes on it. Any ideas?

Thanks,
Tony

Paul Beck said...

Craig,

Once you have the ULS logs open either using ULS view or notepad (ensure you have the latest ULS file) open the file 2 minutes after getting the error and do a find in the ULS file for the correlation Id (Error Id) you receive. It will be there 100%.

Paul Beck said...

Hi Tony,

Pls provide additional information:
Is you problem for all ModalDialogs? (Specify which ones)
Does this problem occur in various browsers?
What is the error? Add more detail to the process and error so I can take a look.

Anonymous said...

Hi Paul,

The problem is for AddProjectResourceUserControl and BookTimeUserControl. It occurs in both IE 8 and Chrome. After looking at it more closely, I've refined the cause of the error, I think. The error is:

When calling SP.UI.ModalDialog.showModalDialog(options), the . For instance, because Sharepoint does not like the '&' symbol in URLs, the URL for Timesheet Add or Edit should be:

SitePages/Timesheet%20-%20Add%20or%20Edit.aspx?rptid=7&weekid=7&IsDlg=1


However, when calling the ModalDialog, the attempted URL in the browser shows:

SitePages/Timesheet%20-%20Add%20or%20Edit.aspx?rptid=7&weekid=7&IsDlg=1

This results in an error "An unexpected error has occurred".

A temporary, ugly fix I've made is changing the Javascript call from:

javascript:OpenDialogAdr('{5}?rptid={3}&weekid={4}')

to

javascript:OpenDialogAdr('{5}?rptid={3}&weekid={4}')

And instead of opening a ModalDialog, I do a window.open(options.url). This allows the application to work somewhat, but callbacks for refreshes don't work with this method.

Please let me know if you need more information. Your solution is a huge timesaver and is well made and I thank you for it, this little issue has been giving me a bit of a headache, though... I really appreciate your help.

Thanks,
Tony

Anonymous said...

Hi Craig,

If you are getting an application error on all you popup pages, ensure you are using the correct page types that contain the Dialog Framework. For more info see:
http://ranaictiu-technicalblog.blogspot.com/2010/06/ribbon-tab-with-id-has-not-been-made.html

Regards
Paul Beck

Anonymous said...

Hi Paul,
Can I put wsp directly to solution. and activate that wsp. Will it work. I done that but it gives error

Paul Beck said...

Anon 28 Dec - I think you are asking if you can use the wsp in a Solution Gallery (Sandbox solution); you cannot unless you ammend the code to work as a sandbox solution.

Paul Beck said...

If you get:
Unexpected System.ArgumentException: The Ribbon Tab with id: "Ribbon.Read" has not been made available for this page or does not exist. Use Ribbon.MakeTabAvailable().
The pages you are using do not have the dialog framework available, see http://ranaictiu-technicalblog.blogspot.com/2010/06/ribbon-tab-with-id-has-not-been-made.html

Also see: http://blog.sharepointsite.co.uk/

vijay said...

hi i did the timesheet and i stuck in while adding the new bookitem cannot insert the value
i got error.

Paul Beck said...

Hi Vijay,

What is the error message? Need alittle more info to help you get through your problem.

paul

Anonymous said...

Hello Paul,

Thanks a ton for your solution.Regarding the exception "Sequence contains no elements" raised when the Timesheet-BookTimeItem webpart is added, you gave 2 solutions.

1.Proper seed data should be filled in all tables - I filled the data, but still it gives an exception.Do you have any sql file which generates the seed data needed to add this web-part with out any trouble?

2.Ammend the LINK method from .Single() to .SingleDefault(). Or put a try catch block around this code - I have added your timesheet solution using the wsp file that you have provided.In which file should I make this change?

I am sorry if I ask you too naive questions.i am still in the process of learning sharepoint !

Please Help

Regards,
Kiran

Paul Beck said...

Hi Kiran,

The solution is meant as a base to build a timesheet solution hence the project files are downloadable however you can use the wsp's but you need to get your seed data correct. The issus people hit is that the foreign keys are not correct.
1.> Good suggestion on the base data, I look into providing data for the soluttion.
2.>You ned to compile you own code/wsp to use .SingleDefault so unless you use Visual Studio, thei isn't an option for you.

Anonymous said...

Hi Paul

Thanks for this walk through. I am a novice at this and I would like to ask a question. Using SP Foundation you say to create a new Publishing site. SP Foundation however doesnt have publishing infrastucture. So just creating a new blank site instead as the first page and adding the web parts as per your instructions above, when I try and connect the web parts I get a long page error.

I believe that I have created all of the databases etc but it is this first part that I cant seem to get past.

Thanks

Brett

Paul Beck said...

Hi Brett,

In SP foundation you can add 2 types of pages: Page &
Web Part Page.

If you used "Page" rather use the "Web Part Page" as the page template. Pls post the error message or entry out the ULS as I think this may be your issue.

Anonymous said...

Hi Paul,

I really appreciate your efforts as well as the others who have contributed to this effort. I am not a programer, but someone looking for a time card solution in Sharepoint. Specifically, Sharepoint on MS 365.

It does not appear that the solution that is provided here will work. Any suggestions?

Thanks,

Greg

Paul Beck said...

Hi Greg,

This solution will not work on SharePoint Online (SPO) (Office 365), it is an on premises SharePoint 2010 solution. Could be a good project for a programmer to make it SPO ready however I have no intention of making this available on SPO.

Anonymous said...

Hi Paul,

I am having a bit of a problem setting this up. I haven't done too much programming with SharePoint and I was thinking about implementing your solution to see how it works.

Basically I have done everything up until Part 4 but I keep getting an "Unexpected Error Occuring". I have tried looking in the ULS logs and my error message is below. Do you have any idea why this is happening? Is the connection to the databse not working?

Thank You,
Tudor

06/25/2012 11:05:45.06* w3wp.exe (0x0BE0) 0x2938 SharePoint Foundation Runtime tkau Unexpected ...ssword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.Provi... c2db58a2-e779-49d7-96c7-ffcd827759f7
06/25/2012 11:05:45.06* w3wp.exe (0x0BE0) 0x2938 SharePoint Foundation Runtime tkau Unexpected ...derBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression) at System.Linq.Queryable.Single[TSource](IQueryable`1 source) at PaulBeck.Timesheet.WebParts.Consultant.ConsultantUserControl.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.Event... c2db58a2-e779-49d7-96c7-ffcd827759f7
06/25/2012 11:05:45.06* w3wp.exe (0x0BE0) 0x2938 SharePoint Foundation Runtime tkau Unexpected ...ArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.AddedControl(Control control, Int32 index) at PaulBeck.Timesheet.WebParts.Consultant.Consultant.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() ...

Paul Beck said...

Hi Tudor,

Check your connection string in the web.config. The connection string varies depending on where your database is and the security setup on SQL.

Anonymous said...

Hi Paul,

Thanks for the reply. I have changed the connection string and am no longer getting any error, however, nothing shows up in my consultant or any of the other drop down menus. (I have populated each one of the sql tables with one value, so that should show up right?) Would the connection string still be the problem here?
I followed this guide to get the correct connection sting information: http://www.gotknowhow.com/articles/test-a-database-connection-string-using-notepad

Also, I am confused how to create the pop up pages. I have added the code in the web config as highlighted but what's next? Sorry if its a super simple answer but this is something I can't seem to get right.

Thanks again,
Tudor

Anonymous said...

EDIT to my previous post, I don't think the connection string is the problem. I have added some of the Admin web parts and I can see my values in the drop downs and can add new Clients and Projects to the database so the connection string is working fine BUT I still can't see the Consultant drop down options and I entered a record in the Resource table. Any idea why this is?

Thanks again,
Tudor

Paul Beck said...

Hi Tudor,

You latest comment has 3 parts so I'll address them seperately.

Connection string: It sounds like your connection string is now fixed, as you are not getting an error this sounds proven to me.

Consultant dropdown: Works by checking is the current login user is a site collection (SC) administrator, if you are it will show all records in the resources/consultants db table. If the logged in user is not a SC admin, you will only see your own timesheet and details in the ddl. Key is the logged in user name needs to match the value in the db. If you look at the source html for the drop down consultant list, are there any values? If so tell me the text and value.

Popups: The web.config dictates the path to the popup pages. So for each web.config entry the corresponding relative path needs to be added. Also note that the path is from the web app for the web.config entries not from the SC url.

Anonymous said...

Thanks for the reply and all the help Paul. The connection string is definitely fine, as I created the admin page, the drop downs work and I can insert a client into the database. I also figured out the popup pages! :) I didn't want to send another post with that update but I ended up figuring that out.

Currently I am logged in as the Farm Administrator for SharePoint, and this is in my test environment. I have another user that I tried logging in with that is just a regular Domain User. So when I am logged in as Farm Administrator I should be able to see all users right? But I can't see any and I have entered my Domain User's name into the Resource Table but I still can't see him in the drop down. All the drop downs work for the Admin web parts so I'm not too sure what I did wrong here.

One other issue I am having is, as many others have posted, with the BookTimeItem web part. Basically I wanted to take the route to edit the code but I have no idea where to add the .SingleDefault(). I have extracted the .wsp package and have looked through the files to find where the .Single() method is being called but I can't find it.....am I doing something wrong? I have never created or modified a .wsp package before so thanks for any help on this. Editing this method name should then fix the issue with the BookTimeItem? Or should I repopulate the database?

Anonymous said...

Sorry to send another comment but I forgot to answer one of your questions. Tere are no values forthe drop down consultant list in the html source.

Paul Beck said...

Tudor: "So when I am logged in as Farm Administrator I should be able to see all users right?" Paul: Correct
Tudor: Farm admin can't see al users.

Paul: "The farm admin shows up as the 'System Account' so the resource/people picker does not work, ammend the user in the table. If you are a site collection administrato you will see everyone, I suggest explicitly adding the farm account as the SC admin".

Tudor: " .SingleDefault() fix". Paul: "Code change is if you are editing the timesheet programtically in VS, you aren't so you fix is ensure your data in the SQL Server datbase tables are correct."

Note: This is not a commercial project but guidance for creating a timesheet in SharePoint, so you need to work through all these issues such as populating the SQL Server tables with the correct data.

Anonymous said...

Ah I figured it out, basically the tables that need to have some data inserted are: Clients, Project, and Resource, the rest will be automatically populated by the web parts when timesheets are filled out. I had entered some data in the other tables and that's what was causing the errors so I removed that data and it all works now and it pretty cool haha. Thanks Paul! And thanks for all the help! I'm going to try and expand on it but this was a great start, thanks a lot!

Unknown said...

Thanks for this project Paul, im still learning but its going well..

Managed to get everything working ish, apart from after getting the screens to show once i can no longer get on to them. i get the unexpected error occured. in ULS the error is

System.NullReferenceException: Object reference not set to an instance of an object.
at PaulBeck.Timesheet.WebParts.Week.Week.get_GetWeekId()
at PaulBeck.Timesheet.WebParts.BookTime.BookTime.ReceiveProvider(IWeekId p)

Paul Beck said...

Hi Martin,

It looks like the seed data in your database is incomplete. Open the week table and verify there is a week with the Id you are using.

Weeks should be automatically created so I guess you must be missing a step.

Unknown said...

Thanks for the quick reply... i have created a single entry in the dbo.weekentry table and also the dbo.dayentry table refering to the same weekentryid.

however everytime i try t reenable the webpart on the home page i get that error still. until this works i guess this i the same reason the add-or-edit page isnt working.

thanks for your help

Paul Beck said...

The project is made for customisation, hence no error catching is added to the code. You appear to of missed a step. I'd suggest you walk through the tutorial/posts again. You error is causes as the underlying database is missing entries that relate to one another.

Unknown said...

Hi Paul, i have gone through all the steps again, and believe everything has been done. i can access the admin pages ok, i have a list of consultants, a couple of projects and clients. i can create projects via the site. but unable to add tasks. Anything else you suggest... very frustrated, so close yet so far...

thank you for your help

Unknown said...

think im getting closer... i decided to remove the exisiting week webpart and re add it to the page. this tie its working. but now when i try to link week to booktime i get the following error.

The connection point "weekIdConsumer" on "g_30b......." does not allow multiple connections.

Unknown said...

its got even better... managed to get the home page sorted.

so now when using the timesheet-add-or-eedit popup the date ddl is empty and when trying to submit a tast errors with...

System.FormatExceptio: Input string was not in a correct format.

your assistance has been very appriciated, thanks Paul... iou 1 beer so far

Paul Beck said...

Hi Martin,

I'm kind of lost with where you are up to. If you have followed all the steps, log how you get each error, include the error message and additional info. I'd suggest you run in debug mode, it makes figuring ou the issue a lot easier.

Unknown said...

only thing not working is the timesheet-add-or-edit.aspx webpart booktimeitem. it does not display any day information in the ddl. the timeshhe week webpart on the home page is now working along with the rest of the items.

Paul Beck said...

Martin - You are going to need to debug the project. When it gets to the ddl, it sounds like the format it's getting differs from that the code can handle. By debugging you'll fix thi pretty quickly.

Unknown said...

ok. sorry for being nieve at this point, but i cannot see any where for debugging...

i have noticed in the dbo.dayentry table which it has now autopopulated after adding some seed data, is that although i have week id 1,2,3 etc and day number 1-7 which makes sense. i have duplicated daydates. for instance i have 3x 2013-02-18 same daynumber but different weekentry id? is this correct?

Paul Beck said...

This is a project for extending, you can install it without recompiling but you need to get all the settings and env variables correct. Open Visual Studio 2010 to get debugging.

Something is not working as it should seed this data for you.

Unknown said...

Still downloading and gona install VS2010, but this is the full error from ULS.

System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Convert.ToInt32(String value)
at PaulBeck.Timesheet.WebParts.BookTimeItem.BookTimeItemUserControl.btnInsert_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

thanks again

Unknown said...

Hi Paul,
Please excuse me if I sound silly. I have made changes to web.config. In the last part of your write up, you have added web parts on the site page. I have created a site, but I cant see anything under web parts to add. Do I need to upload any web part first?

Paul Beck said...

Hi Pranay,

web.config and the web parts are different. Follow these posts in the order they are given and it will work. If you tell me what your error is so I can help you (ULS or error logging).

paul

Skents said...

Paul,

Correct me if I am wrong but your scripts add no seed data to the tables am I correct? If this is the case, exactly what seed data is required to make the solution function?

Unknown said...

Hi Paul,

I am having the same problem with the webpart BookTimeItem.
I've filled proper seed data manually in all the 7 tables in SQL Server. Amended the LINQ methods from .Single() to .SingleToDefault() of all occurences in BookTimeItemBOL.cs file. Then redeployed the package using "Install-SPSolution -Identity paulb-timesheet.wsp -WebApllication http://esystfs:8138 -GACDeployment -force" cmdlet in Powershell. Finally, embedded this webpart in a new page and not in a webpart page.

Have I done anything wrong in any of the above mentioned steps? I am sorry if I ask you too naive questions. I am still in the process of learning sharepoint!

Regards,
Harish

Unknown said...

Also Im unable to debug the solution as it asks for the credentials to access your tfs server..

Paul Beck said...

Hi Harish,

Download the Visual Studio Solution file, remove the tfs binding and then you work on the code, this allows you to create the new wsps with code changes and your own customisations. Once you have done this and created the wsp's and deployed the wsps - it should work. If it doesn't give me the error message so I can help you figure out what is wrong.

satheesh said...

This is a great post. Thanks much. I have added all the webparts. i am done with all steps. I am getting the below error message:

[NullReferenceException: Object reference not set to an instance of an object.]
PaulBeck.Timesheet.WebParts.Week.Week.get_GetWeekId() +84
PaulBeck.Timesheet.WebParts.BookTime.BookTime.ReceiveProvider(IWeekId p)

satheesh said...

Timesheet - BookTime grid is loading the details from the previously selected Consultant.

Example:
user1 has 3 "Timesheet - BookTime" entries
user2 has 0 "Timesheet - BookTime" entries
user3 has 4 "Timesheet - BookTime" entries

if i select user1, the "Timesheet - BookTime" entries are blank.

if i select user2, the "Timesheet - BookTime" entries are displayed for user1.

if i select user3, the "Timesheet - BookTime" entries are displayed for user2.

Please advise





Paul Beck said...

Hi Satheesh,

The nullReferenceException looks like the query is not returning any data. Check the weeks table data is correct if you can't see the issue you will need to debug.

For the wrong data being displayed - Check your database relationships, it looks like your data has changed making it inconsistent. Once again debugging may be your easiest option.

I'd advise you copy the database and source code to a dev machine if this is live and walk thru in debug mode.

Unknown said...

Hi paul got the timesheet fully functioning, how do i now go about reporting on the data from sharepoint. preferred output format is cvs

Paul Beck said...

Ifshann, BCS and Excel are options or use SSIS to export the data you want from SQL.

Unknown said...

hi paul, go the data reporting. i now want to set up a approval email notification how would i implement this?

Post a Comment