Wrox Programmer Forums
|
BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9
This is the forum to discuss the Wrox book Professional SharePoint 2007 Development by John Holliday, John Alexander, Jeff Julian, Eli Robillard, Brendon Schwartz, Matt Ranlett, J. Dan Attis, Adam Buenz, Tom Rizzo; ISBN: 9780470117569
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2010, 08:40 AM
Registered User
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 - Sample Collaboration Solution

Hi,

I'm a beginner at Sharepoint development and C# in general, although I have been coding in other languages for many years.

I've been working through the example in this chapter but couldn't get it to send the notification email. After spending a couple of hours messing around with the code and writing debug messages out to the Windows event log (can't debug using MS Visual C# Express), I found out that the line in the LoadHiringManagersEmail method:

Code:
SPItem jobItem = jobList.Items[jobValue.LookupId];
was throwing the error "Specified argument was out of the range of valid values". The line to retrieve the correct Department list item was doing exactly the same thing. My debug messages were showing that it was definitely retrieving the correct Job Title from the Applicant item, but it was throwing an error trying to retrieve the corresponding Job item from the job list.

I eventually found that using:

Code:
SPItem jobItem = jobList.Items.GetItemById(jobValue.LookupId];
did work. I rewrote the code so many times that I don't think it can have been a typo or a copy error, and I'm pretty confident that I set up my Department and Jobs lists correctly.

Can anyone explain to me why using the
Code:
jobList.Items.GetItemById(jobValue.LookupId)
method worked, when using
Code:
jobList.Items[jobValue.LookupId]
would not?

I'd appreciate any comments or pointers as I'm not satisfied with just having got it working - I need to understand why in order to really learn.

Many thanks,
Emily.

Platform is WSS 3.0 running on Windows Server 2003 R2 in a HyperV terminal.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 (A Sample Collaborative Solution) Dave_W BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 3 February 25th, 2009 08:58 AM
Solution to exercise 7, Chapter 2 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 May 28th, 2006 04:28 AM
solution 1 in exercises in chapter 6 juan_forum BOOK: Beginning Java 2 0 September 16th, 2005 11:03 AM
Visual Studio solution file for sample code? davem1958 ASP.NET 1.0 and 1.1 Professional 1 October 10th, 2003 12:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.