Question

Mon cas d'utilisation est la suivante: je veux créer un système de gestion d'événements sans utiliser des espaces de travail de rencontre (malheureusement, je ne peux pas les utiliser, au moins le Senior Dev. m'a dit). Il doit y avoir:

  • une liste de calendrier, modifiable par un administrateur (peut ajouter / éditer / supprimer des événements), visible par les participants (ils doivent simplement afficher les détails et avoir la possibilité de vous inscrire / désinscrire).

  • une liste des participants pour chaque événement créé (ne sais pas si cela est la meilleure pratique, d'autres suggestions seraient hautement appréciées).

    Donc, je veux ajouter un "registre" / "Unregister" bouton / ruban / lien vers chaque événement. Le participant cliquez dessus et il / elle est ajouté à la liste des participants pour un événement.

    Mon problème, pour être honnête: je ne sais tout simplement pas comment atteindre cette fonctionnalité. J'ai une petite expérience avec ASP.NET/C# et beaucoup plus avec le développement Web, mais je suis assez nouveau à SP2010 (en utilisant Server 2010 Standard sur Win Server 2008 R2 avec SQL Server 2008 R2) et son modèle d'objet / meilleures pratiques et À mon avis, il est très difficile de trouver votre chemin à travers la complexité SP2010.

    Ce serait donc très agréable si vous pouviez m'aider avec une meilleure pratique, une suggestion ou juste un indice rapide. Je sais que certaines modèles commerciaux présentent cette fonctionnalité, mais ils sont chers et totalement sur le dessus pour nos besoins (une école).

    meilleures salutations, Pinguwien

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top