SharePoint Developer Center > SharePoint Products and Technologies Forums > SharePoint - Development and Programming > Restrict Access to Discussion list / forum to user who creates discussion and one other user
Ask a questionAsk a question
 

Proposed AnswerRestrict Access to Discussion list / forum to user who creates discussion and one other user

  • Saturday, October 24, 2009 3:07 PMIanMills Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello

    I have a scenario where I would like allow a private discussion board between a teacher and a parent via SharePoint. I am looking for a way that the teacher can see all the discussions in a discussion board and reply accordingly but the parent can only see the discussion they create and the replies from the teacher.

    I am prepared to pay for a solution or tweak to the existing discussion board (audiance targeting or field level permissions perhaps).

    Any ideas would be gratefully received.

    thanks

    Ian

All Replies

  • Sunday, October 25, 2009 8:38 AMIvan Padabed Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    audience targeting is not good for security reasons, I would recommend evet handler here. it should be fired on itemAdded and update item-level permission to allow creator (parent) and particular group (teacher(s)) access only - for top level items (disussions), and set same security settings for replies.
  • Sunday, October 25, 2009 11:36 AMGuru Karnik Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You can distinguish between the discussion and the replies using the ContentType of the list item in the ItemAdded event. The content type of replies is "Message".


    Regards
    Prasad
  • Sunday, October 25, 2009 4:33 PMMarkus I_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Ian,

    As faras I understand you you are ale to develop a solution on your own?


    The trick is to take use of item level permission, see me response here


    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/320798e9-fec3-4ad4-98f4-29e3600e7784

    As a new discussions is opened (Item-Eventtype "ItemAdded") look who has opened it and call "BreakRoleInheritence" on the item. Now add the opener plus the teacher group with appropriate roles to the item. Handle replies the same.

    Now only the opener & teacher group will see the topic and can reply to it, that`s the trick!
    • Proposed As Answer byMarkus I_ Sunday, October 25, 2009 4:33 PM
    •  
  • Sunday, October 25, 2009 6:59 PMIanMills Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello

    Thanks very much for your reply, I am currently not skilled enough to develop a solution.  I am prepared to learn, can you recommend any sites to help me get to the point where I can develop a solution on my own.  How difficult is it, I have the choice to get someone in to do it for me or learn to do it myself.  Difficulty and therefor time factors will influence what I do.  Could you go into any more detail on what I need to do.

    I understand what you have said just dont know how to do it.  Sorry for all the questions.

    cheers

    Ian
  • Sunday, October 25, 2009 7:43 PMIanMills Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Think I have found a solution on codeplex, dont know why I didnt see it before.

    http://spchangepermission.codeplex.com/

    Seems to set permissions after a item is created, dont know if it will work with discussion board, will give it a go.

    Ian
  • Monday, October 26, 2009 10:14 AMIanMills Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The above solution did not work.

    Any extra help or other suggestions would be great.

    cheers

    Ian
  • Wednesday, October 28, 2009 3:53 AMAaron Han - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi, Ian

           If the 3rd  party component could not achieve your requirement, I would recommend you turn to development.

           Thanks for all helpful suggestions, and I am also more inclined to use eventhandler to update item-level permission.

           As Markus and Prasad’s advice, you can distinguish the discussion and the replies with ContentType, then set item permission (creator: parent /teacher) via code.

           A simple sample for this:

           ------------------------------------------------------------------------------------------

           public class DiscussionEvent:SPItemEventReceiver

           {

                public override void ItemAdded(SPItemEventProperties properties)

                {

                      base.ItemAdded(properties);

                      string contentType = properties.ListItem["ContentType"].ToString();

                      properties.ListItem.BreakRoleInheritance(true);

                      if (contentType.Equals("Discussion"))

                      {

                           //Set permission

                      }

                     else if (contentType.Equals("Message"))

                     {

                          //Set permission

                     }

                     properties.ListItem.Update();

                }

        }

           ------------------------------------------------------------------------------------------

            For eventhandler development, you can refer these articles:

            http://msdn.microsoft.com/en-us/library/ms437502.aspx

            http://karinebosch.wordpress.com/walkthroughs/sharepoint-event-handlers/

     

            Also, here is a sample for setting permissions in eventhandler

            http://www.sharepoint-tips.com/2007/03/sample-event-handler-to-set-permissions.html

     

    Hope this can help.     

     

    Best Regards,

     

    Aaron

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com  

  • Friday, November 06, 2009 10:00 AMAaron Han - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Ian,

     

         Would you please let me know if all suggestions are helpful for your issue?

         If you need further assistance, please feel free to let me know.

     

         Have a nice day!

     

    o  Aaron

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contact tngfb@microsoft.com