Wikis and current group

Wikis and current group

This question is not answered

I’m using this line within the ApplicationPostModule (CSModule) to grab the current group which I then check extended attributes for to determine some custom data we've set in another screen:

group = CSContext.Current.GetCurrent<Group>() as Group;

This works fine for all the other applications but wikis always report the Site Root group instead of the one I’m currently in.

Is there a work around?

All Replies
  • What version are you running?
     
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: synergyauto [mailto:bounce-synergyauto@communities.telligent.com]
    Sent: Monday, April 23, 2012 12:46 PM
    To: discussion_evolution@communities.telligent.com
    Subject: [Telligent Evolution Platform Discussion] Wikis and current group
     

    I’m using this line within the ApplicationPostModule (CSModule) to grab the current group which I then check extended attributes for to determine some custom data we've set in another screen:

    group = CSContext.Current.GetCurrent<Group>() as Group;

    This works fine for all the other applications but wikis always report the Site Root group instead of the one I’m currently in.

    Is there a work around?

  • Sorry, I tried to delete this thread as I just found the answer myself, but it wouldn't let me.

    In case anyone else is wondering, we're running 6.0 and this is the

    WikiEvents_Page(Telligent.Evolution.Wikis.Components.Page page, System.EventArgs e)

    event.  page exposes a wiki object, and a sub-object is group.

    I do hope someday that wiki's will join the rest of the applications in their one united set of access objects instead of us having to double all our current code just to support wikis.

  • So I need to add that working directly with the Page object is currently not a supported API.  You should only use it to obtain the ID of that page and retrieve the Public Api version on the page with it.
     
    var apiPage = PublicApi.WikiPages.Get(new WikiPagesGetOptions(){Id=page.ID});
     
    You should then only work with apiPage.
     
    You also figured it out but it should be mentioned to not use GetCurrent<> inside a module because you don’t reliably have access to the information that method need.  If you need parent/sub objects they should be retrieved from data on the incoming object using the API.
     
    If you use supported Apis you will find that they do in fact consistently expose parent/child objects or at least provide identifiers to retrieve them.
     
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: synergyauto [mailto:bounce-synergyauto@communities.telligent.com]
    Sent: Monday, April 23, 2012 1:03 PM
    To: discussion_evolution@communities.telligent.com
    Subject: RE: [Telligent Evolution Platform Discussion] Wikis and current group
     

    Sorry, I tried to delete this thread as I just found the answer myself, but it wouldn't let me.

    In case anyone else is wondering, we're running 6.0 and this is the

    WikiEvents_Page(Telligent.Evolution.Wikis.Components.Page page, System.EventArgs e)

    event.  page exposes a wiki object, and a sub-object is group.

    I do hope someday that wiki's will join the rest of the applications in their one united set of access objects instead of us having to double all our current code just to support wikis.

  • Patrick,

    Using the methods outlined in your post, once I have the apiPage variable loaded, what property/method of it am I using to get a group object that I can then call getExtendedAttributes() on?

  • WikiPage(apiPage) also contains its parent Wiki which in turn has its group.  You then access the extended attributes via the Group.ExtendedAttributes
     
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: synergyauto [mailto:bounce-synergyauto@communities.telligent.com]
    Sent: Monday, April 23, 2012 1:33 PM
    To: discussion_evolution@communities.telligent.com
    Subject: RE: [Telligent Evolution Platform Discussion] Wikis and current group
     

    Patrick,

    Using the methods outlined in your post, once I have the apiPage variable loaded, what property/method of it am I using to get a group object that I can then call getExtendedAttributes() on?

  • I'm not sure I'm following you on that one, is this what you meant or is this another way of doing it?

    var apiPage = PublicApi.WikiPages.Get(new WikiPagesGetOptions() { Id = page.ID });

    var group = PublicApi.Groups.Get(new GroupsGetOptions() { Id = apiPage.GroupId });

  • Should be as easy as

    var apiPage = PublicApi.WikiPages.Get(new WikiPagesGetOptions() { Id = page.ID });

    var group = apiPage.Wiki.Group;
     
    of course with null checks and such J
     
    Your way will work too, but you should already have a group through the hierarchy.  Its up to you, either way are proper uses of the API
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: synergyauto [mailto:bounce-synergyauto@communities.telligent.com]
    Sent: Monday, April 23, 2012 2:29 PM
    To: discussion_evolution@communities.telligent.com
    Subject: RE: [Telligent Evolution Platform Discussion] Wikis and current group
     

    I'm not sure I'm following you on that one, is this what you meant or is this another way of doing it?

    var apiPage = PublicApi.WikiPages.Get(new WikiPagesGetOptions() { Id = page.ID });

    var group = PublicApi.Groups.Get(new GroupsGetOptions() { Id = apiPage.GroupId });

  • This is where my confusion came in...Wiki isn't exposed by apiPage, only WikiID

  • Ahh, you are correct, I was looking in the wrong place.
     
    In that case getting the group from the page’s groupID is fine, just make sure its set first. Since its nullable.
    Patrick Mason
    Development Lead- Extensibility
    o: 214.420.1329
    telligent.com
     
    From: synergyauto [mailto:bounce-synergyauto@communities.telligent.com]
    Sent: Monday, April 23, 2012 2:40 PM
    To: discussion_evolution@communities.telligent.com
    Subject: RE: [Telligent Evolution Platform Discussion] Wikis and current group
     

    This is where my confusion came in...Wiki isn't exposed by apiPage, only WikiID