Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
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.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05:28 AM
solution 1 in exercises in chapter 6 juan_forum BOOK: Beginning Java 2 0 September 16th, 2005 12:03 PM
Visual Studio solution file for sample code? davem1958 ASP.NET 1.0 and 1.1 Professional 1 October 10th, 2003 01:06 PM



All times are GMT -4. The time now is 04:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.