stuartridout / teamlink

TeamLink is a free Microsoft Teams Power App using Dataverse for Teams. It is a space where your team can share there whereabouts for the week ahead directly in Microsoft Teams. Users can select who they want to 'follow' and see the upcoming presences of or can view by site to see who is planning to be on site on that day. TeamLink allows you then to message to see if the person wants to meet up for a coffee ... all from the click of a button!
MIT License
51 stars 2 forks source link

Flat team structure #6

Open tdashworth opened 2 years ago

tdashworth commented 2 years ago

Our team contains about 50 members with multiple levels of management in a "reviewer tree". Therefore, looking at my manager's reports is not sufficient to represent the entire team.

We have modified the app to instead pull the user list from Dataverse for Teams filtering out disabled users.

Could this be another option built into the app?

stuartridout commented 2 years ago

Hi Tom. So you've modified the app to show the members of the Team that it is installed into?

tdashworth commented 2 years ago

Hi @stuartridout,

This is the primary change we've made: image

It does impact performance with a new team of 150+ but the "Peers" model isn't ideal for us. I've suggested to the team we used the pinned and sites view predominately.

Once again, great app!

MathieuWuyts commented 2 years ago

We would like to implement the function to see all the members of the Team it is installed in. Is this possible? If it's easy to code I could implement it instead of the Peers view

tdashworth commented 2 years ago

@MathieuWuyts I've already achieved this in my previous comment. I updated both the OnVisible and OnSelect.

MathieuWuyts commented 2 years ago

That's what I thought. I tried implementing it:

Set( hasLoaded; false );; Switch(teamViewType;"Directs";ClearCollect(thisTeamList;Office365Users.DirectReportsV2(teamViewParentEmail).value.mail);"Peers"; //Clear(thisTeamList);; //Patch(thisTeamList;Defaults(thisTeamList);{mail:Office365Users.ManagerV2(teamViewParentEmail).mail});; //ClearCollect(thisTmpTeamList;Office365Users.DirectReportsV2(Office365Users.ManagerV2(teamViewParentEmail).mail).value.mail));; //Collect(thisTeamList;SortByColumns(thisTmpTeamList;"mail";Ascending));; ClearCollect( thisTeamList; RenameColumns( ShowColumns( Filter( Users; Status = ‘Status (Users)’.Enabled; EndsWith(‘Primary Email’; “@xxx.xx”) ); “internalemailadress” ); “internalemailadress”; “mail” ) );
If(teamViewType="Directs"||teamViewType="Pinned";ClearCollect( teamViewAvailability; Filter( Presences; Email in thisTeamList.mail ) ));; Set( hasLoaded; true );;

This changes nothing tho. Please note this is also my first try at Power Apps; and I don't know where I can find OnSelect.

MathieuWuyts commented 2 years ago

Seems easier with a picture: image

tdashworth commented 2 years ago

@MathieuWuyts you'll need to change the domain name (@xxx.xxx) to match your organisation. We found there were additional users which we wanted to filter out.

MathieuWuyts commented 2 years ago

That I get, that's done in mine. I also changed the My Team button with the filter, but I get errors saying there is an operator expected, but I don't see where

tdashworth commented 2 years ago

@MathieuWuyts I'm also noticing a lot of ; in for code that should be ,.

MathieuWuyts commented 2 years ago

Wow you were right. Sloppy. This is what I have now for the OnSelect My Team/Peers button: image

Still got errors, saying unexpected characters(?)

tdashworth commented 2 years ago

This is what we have exactly.

Edit Presence and View Any Team.OnVisible =

Set(
    hasLoaded,
    false
);
Switch(
    teamViewType,
    "Directs",
    ClearCollect(
        thisTeamList,
        Office365Users.DirectReportsV2(teamViewParentEmail).value.mail
    ),
    "Peers",
    Clear(thisTeamList);
    //Patch(
    //    thisTeamList,
    //    Defaults(thisTeamList),
    //    {mail: Office365Users.ManagerV2(teamViewParentEmail).mail}
    //);
    //ClearCollect(
    //    thisTmpTeamList,
    //    Office365Users.DirectReportsV2(Office365Users.ManagerV2(teamViewParentEmail).mail).value.mail
    //);
    ClearCollect(
        thisTeamList,
        RenameColumns(
            ShowColumns(
                Filter(
                    Users,
                    Status = 'Status (Users)'.Enabled,
                    EndsWith('Primary Email', "@example.com")
                ),
                "internalemailaddress"
            ),
            "internalemailaddress",
            "mail"
        )
    );

);
//Collect(
//    thisTeamList,
//    SortByColumns(
//        thisTmpTeamList,
//        "mail",
//        Ascending
//    )
//);
If(
    teamViewType = "Directs" || teamViewType = "Pinned",
    ClearCollect(
        teamViewAvailability,
        Filter(
            Presences,
            Email in thisTeamList.mail
        )
    )
);
Set(
    hasLoaded,
    true
);

btnMyPeers.OnSelect =

Set(
    startTimer,
    false
);
Set(
    hasLoaded,
    false
);
/*Load Team*/
Set(
    teamViewParentEmail,
    myMail
);
Set(
    teamViewType,
    "Peers"
);
//Clear(thisTeamList);
//Patch(thisTeamList,Defaults(thisTeamList),{mail:Office365Users.ManagerV2(teamViewParentEmail).mail});
//ClearCollect(thisTmpTeamList,Office365Users.DirectReportsV2(Office365Users.ManagerV2(teamViewParentEmail).mail).value.mail);
//Collect(thisTeamList,SortByColumns(thisTmpTeamList,"mail",Ascending));
ClearCollect(
    thisTeamList,
    RenameColumns(
        ShowColumns(
            Filter(
                Users,
                Status = 'Status (Users)'.Enabled,
                EndsWith('Primary Email', "@example.com")
            ),
            "internalemailaddress"
        ),
        "internalemailaddress",
        "mail"
    )
);
ClearCollect(
    teamViewAvailability,
    Filter(
        Presences,
        Email in thisTeamList.mail
    )
);
Set(
    startTimer,
    true
);

I hope this helps 😄

MathieuWuyts commented 2 years ago

Literally copied it, when I press the My Team button in the preview it doesn't do anything. The Pinned List stays open. When I press the Pinned List button the list refreshes, but the My Team button doesn't load.

Also maybe edit the email out

tdashworth commented 2 years ago

Hummm, are you getting any errors you can share?

If you are comfortable with Power Apps, try creating a new screen with a gallery and apply the same source. Does that work?

RenameColumns(
        ShowColumns(
            Filter(
                Users,
                Status = 'Status (Users)'.Enabled,
                EndsWith('Primary Email', "@example.com")
            ),
            "internalemailaddress"
        ),
        "internalemailaddress",
        "mail"
    )
MathieuWuyts commented 2 years ago

image image

MathieuWuyts commented 2 years ago

Looks like a new gallery works correct: image

MathieuWuyts commented 2 years ago

I get these red things when trying: image

tdashworth commented 2 years ago

On the new gallery page, you need to set the above formula to the Gallery.Items property, not OnVisible. If it works, it should list the users' email addresses.

Try these formulas without the commented lines. Also, I notice you still have "example.com" in your screenshots.

Edit Presence and View Any Team.OnVisible =

Set(
    hasLoaded,
    false
);
Switch(
    teamViewType,
    "Directs",
    ClearCollect(
        thisTeamList,
        Office365Users.DirectReportsV2(teamViewParentEmail).value.mail
    ),
    "Peers",
    ClearCollect(
        thisTeamList,
        RenameColumns(
            ShowColumns(
                Filter(
                    Users,
                    Status = 'Status (Users)'.Enabled,
                    EndsWith('Primary Email', "@example.com")
                ),
                "internalemailaddress"
            ),
            "internalemailaddress",
            "mail"
        )
    );
);
If(
    teamViewType = "Directs" || teamViewType = "Pinned",
    ClearCollect(
        teamViewAvailability,
        Filter(
            Presences,
            Email in thisTeamList.mail
        )
    )
);
Set(
    hasLoaded,
    true
);

btnMyPeers.OnSelect =

Set(
    startTimer,
    false
);
Set(
    hasLoaded,
    false
);
/*Load Team*/
Set(
    teamViewParentEmail,
    myMail
);
Set(
    teamViewType,
    "Peers"
);
ClearCollect(
    thisTeamList,
    RenameColumns(
        ShowColumns(
            Filter(
                Users,
                Status = 'Status (Users)'.Enabled,
                EndsWith('Primary Email', "@example.com")
            ),
            "internalemailaddress"
        ),
        "internalemailaddress",
        "mail"
    )
);
ClearCollect(
    teamViewAvailability,
    Filter(
        Presences,
        Email in thisTeamList.mail
    )
);
Set(
    startTimer,
    true
);
lazo8592 commented 2 months ago

@tdashworth @stuartridout

Hi guys, is there a way with Teamlink to add another row for presence i.e. if someone is at an event in addition to the other options like Home or Office. Pleas help, thanks