5

my use case is: I want to create an event management system without using meeting workspaces (sadly I/We can't use them, at least the senior dev. told me). There shall be:

  • One Calendar List, editable by an administrator (can add/edit/delete events), viewable by attendees (they should just view the details and have the ability to register/unregister).

  • One attendee list for every created event (don't know if this is best practice, other suggestions would be highly appreciated).

So, I want to add a "register"/"unregister" button/ribbon/link to every event. The attendee will click it and he/she is added to the attendee list for an event.

My Problem, to be honest: I just don't know how to achieve this functionality. I have a little experience with asp.net/c# and lots more with web development, but I'm fairly new to SP2010 (using Server 2010 standard on Win Server 2008 r2 with SQL Server 2008 r2) and its object model/best practices and in my opinion it's very hard to find your way through sp2010s complexness.

So it would be very nice if you could help me out with a best practice, a suggestion or just a quick hint. I know there are some commercial templates out there having this functionality, but they're expensive and totally over the top for our needs (a school).

Best Regards, Pinguwien

1 Answer 1

7

Pinguwein,

  1. Create a Calendar List where you can Add Events, in List Settings -> List Permissions give your administrator Full Control/Design and All Authenticated Users Read permission!
  2. Create a Event Registration custom list and with other fields create a Lookup Field for Calendar List we made in 1st Step
  3. Open SharePoint Designer and go to Calendar list and under forms, right click DispForm.aspx and click Edit File in Advanced Mode
  4. You will see a List Form Web Part for displaying Event Details, right after this web part you need to add a New Item Form for Registration list
  5. From Ribbon -> Insert -> New Item Form -> Event Registration List
  6. Now you want to set the lookup field of Calendar from Query String which can be seen in this post: Setting SharePoint Form Fields Using Query String Variables Without Using JavaScript
  7. You will be able to use this form for Registering for an Event... Now what if the person is already registered for the event, you want to show him his registration and a delete option!
  8. From Ribbon -> Insert -> Data View -> Event Registration List... XSLTListViewWebPart should appear, apply filters to show data for current Event [you can take ID from Query String for the Calendar and apply filter on lookup field] and show data for current User only
  9. Now both Registration web part and Registration listing are showing, you need to hide the Registration web part if already registered
  10. Use JavaScript to decide which Web Part to show, you can use JavaScript Client Object Model [ECMAScript] to check if the current user is already registered for the event.

This is a without coding solution, with a little bit of JavaScript... Let me know if you need any help!

If you want to go for Visual Studio - then a lot can be done...

  1. You can make a Visual Web Part with just two buttons Register and UnRegister and place the Visual Web Part on DispForm we updated!
  2. Get SPList for Calendar and get SPListItem from SPList.GetItemById() [get event id from Query String]
  3. On register button click you can add the user to Attendees field of the event, like this:

    SPUser user = SPContext.Current.Web.CurrentUser; SPFieldUserValueCollection values = (SPFieldUserValueCollection)calendarItem["Attendees"]; values.Add(new SPFieldUserValue(web, user.ID, user.Name)); item["Attendees"] = values;

  4. On unregister button, iterate the SPFieldUserValueCollection and delete the entry for current User!

  5. On page load decide either Register button or Unregister button should be enabled, use SPQuery to see if CurrentUser is already in the Attendees... you will need to use Include with Attendees field

2
  • 1
    Absolutely great answer. I would vote it up if I could yet. Thank you very much! I'll try it with the code solution I think, for it would be nice to have a "registration period" later on (registration is possible just between two given dates) and I think code-solutions are more powerful in order to achieve that.
    – Dominik
    Nov 27, 2012 at 9:53
  • 1
    @Dominik thanks, yes you will have more control in code approach! Nov 27, 2012 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.