SPItemEventHandler Suggestion
Hello everyone,
This is not exactly a problem but I need your suggestion on this.
I am creating a new item to a SPList programmatically. This works fine. I observed that it does not show up on the SPSite until I refresh the page.
Is there something wrong with my browser settings that is making this happen or is this the same with you as well.
Now, I am also creating an ItemAdded event for the same particular list which will trigger some events. I am wondering if the end user is on that SPSite they will not be able to see the current new item added (unless they refresh) .. that's sort of ok but
Will the itemAdded event still trigger in the background? or is that also dependent on this refresh of the page??
Can you throw some light on this.
Thanks
Answers
- event handler will trigger immediately in the background when you are adding item through web interface of sharepoint or through Sharepoint object model code.
Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)- Marked As Answer by.Net Frenzy Saturday, November 07, 2009 10:19 PM
Hi,
You should understand the basic philosophy web development particularly in this case ASP.NET and SharePoint programming. Nothing you make on the server side (for example, list creation) will be propagated automatically to the already downloaded page in the browser of the user. So the page must be refreshed, either by the user or from JavaScript / HTML elements embedded in the page source.
Event receivers run on the server side, so they don't refresh the page in the browser either.
I recommend you the following:
- If you are not familiar with ASP.NET, have a look at the ASP.NET 2.0 Quick Start Tutorial
http://quickstarts.asp.net/QuickStartV20/aspnet/
Most important from the above one for a SharePoint developer are user controls, web parts, master pages, styles, personalization, validation and navigation.
- Download the Windows SharePoint Services 3.0 SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=05E0DD12-8394-402B-8936-A07FE8AFAFFD&displaylang=en
- Download the SharePoint Server 2007 SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=6D94E307-67D9-41AC-B2D6-0074D6286FA9&displaylang=en
The SDKs contain samples and API reference (including web services). You can read the SDKs online on MSDN too (WSS 3.0: http://msdn.microsoft.com/en-us/library/bb931737.aspx, MOSS 2007: http://msdn.microsoft.com/en-us/library/bb931736.aspx).I suggest you to read this free eBook and / or read a lot of blog posts about SharePoint and try to get as much hands-on experience as you can.
7 Development Projects for Microsoft Office SharePoint Server 2007
http://download.microsoft.com/download/0/2/f/02f0f661-88e1-43c2-b523-88d2e9e6802f/7%20Development%20Projects%20with%20the%202007%20Microsoft%20Office%20System%20and%20Windows%20SharePoint%20Services%202007.pdfAnother useful page for beginners:
Track: SharePoint for Developers
SharePoint for Developers Part 1 http://msdn.microsoft.com/en-us/rampup/dd221355.aspx
SharePoint for Developers Part 2 http://msdn.microsoft.com/en-us/rampup/dd320759.aspx
And try to advance step-by-step instead of a big step without understandig what you are doing and why.
A very good understandig of WSS 3.0 (and hence MOSS 2007) can you get from this book:
Inside Microsoft® Windows® SharePoint® Services 3.0
http://www.microsoft.com/MSPress/books/9692.aspx
Peter- Marked As Answer by.Net Frenzy Saturday, November 07, 2009 10:21 PM
All Replies
- event handler will trigger immediately in the background when you are adding item through web interface of sharepoint or through Sharepoint object model code.
Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)- Marked As Answer by.Net Frenzy Saturday, November 07, 2009 10:19 PM
- I am creating a new item to a SPList programmatically.
From where you are adding the new item, is it in the sharepoint site or from any other outside the site?
Event Receiver is having nothing to do with the page refresh, since it runs in the background.
---
Rajesh | My Blog
MCTS - WSS AD, WSS Config, MOSS Config. Hi,
You should understand the basic philosophy web development particularly in this case ASP.NET and SharePoint programming. Nothing you make on the server side (for example, list creation) will be propagated automatically to the already downloaded page in the browser of the user. So the page must be refreshed, either by the user or from JavaScript / HTML elements embedded in the page source.
Event receivers run on the server side, so they don't refresh the page in the browser either.
I recommend you the following:
- If you are not familiar with ASP.NET, have a look at the ASP.NET 2.0 Quick Start Tutorial
http://quickstarts.asp.net/QuickStartV20/aspnet/
Most important from the above one for a SharePoint developer are user controls, web parts, master pages, styles, personalization, validation and navigation.
- Download the Windows SharePoint Services 3.0 SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=05E0DD12-8394-402B-8936-A07FE8AFAFFD&displaylang=en
- Download the SharePoint Server 2007 SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=6D94E307-67D9-41AC-B2D6-0074D6286FA9&displaylang=en
The SDKs contain samples and API reference (including web services). You can read the SDKs online on MSDN too (WSS 3.0: http://msdn.microsoft.com/en-us/library/bb931737.aspx, MOSS 2007: http://msdn.microsoft.com/en-us/library/bb931736.aspx).I suggest you to read this free eBook and / or read a lot of blog posts about SharePoint and try to get as much hands-on experience as you can.
7 Development Projects for Microsoft Office SharePoint Server 2007
http://download.microsoft.com/download/0/2/f/02f0f661-88e1-43c2-b523-88d2e9e6802f/7%20Development%20Projects%20with%20the%202007%20Microsoft%20Office%20System%20and%20Windows%20SharePoint%20Services%202007.pdfAnother useful page for beginners:
Track: SharePoint for Developers
SharePoint for Developers Part 1 http://msdn.microsoft.com/en-us/rampup/dd221355.aspx
SharePoint for Developers Part 2 http://msdn.microsoft.com/en-us/rampup/dd320759.aspx
And try to advance step-by-step instead of a big step without understandig what you are doing and why.
A very good understandig of WSS 3.0 (and hence MOSS 2007) can you get from this book:
Inside Microsoft® Windows® SharePoint® Services 3.0
http://www.microsoft.com/MSPress/books/9692.aspx
Peter- Marked As Answer by.Net Frenzy Saturday, November 07, 2009 10:21 PM
- Hey Moonis, That was excatly what I was looking for. Cheers
- Hi Peter,
Many Thanks for the comprehensive details for my question. I would check all the links posted out. I hope it helps some others as well.
Thanks for taking out time and providing such excellent pointers.
Cheers..!

