Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aaron 4 posts 53 karma points
    Sep 29, 2014 @ 13:19
    Aaron
    0

    Creating a relation between Document and Member Group.

    I am creating department pages that display a list of members in that department. My members are grouped into department Member Groups and I would like to relate these Member Groups to a respective department page with details of each department.

    There is an option in Umbraco (version 7.1.6) to relate Member Groups, however I am not quite sure what to pass to the relate method in the RelationService API.

    I can only seem to find a way to retrieve a list of all roles/member groups rather that a specific member group by its name. Once I've retrieved the individual role/member group using a foreach, the Relate method does not accept it as a simple string. Is there a way of retrieving a Member Group object that I am missing?

    var relationService = Services.RelationService;
    var contentService = Services.ContentService;
    
    var rolesList = memberService.GetAllRoles();
    var busDoc = contentService.GetById(1234);
    
    foreach(var role in rolesList)
    {
        switch (role)
        {
            case "Business Development":
                relationService.Relate(role, busDoc, "departments");
                break;
            etc...
        }
    }
    

    Thanks in advance for any help, Aaron

Please Sign in or register to post replies

Write your reply to:

Draft