PathToSharePoint 8e5c265a01 Add 'samples/react-cherry-picked-content/' from commit '85f9d532109135b43305e2f00923188c16c04226'
git-subtree-dir: samples/react-cherry-picked-content
git-subtree-mainline: 51eebc82dec61439c77fd4ac8046f689bc5daeb4
git-subtree-split: 85f9d532109135b43305e2f00923188c16c04226
2022-03-09 23:43:24 -08:00

23 lines
1.1 KiB
HTML

<div style="background-color: CadetBlue; padding: 20px;">
<h3>My Teams - MS Graph Client</h3>
<p>Isolated mode: &#9888; mandatory. This sample leverages the SPFx built-in Microsoft Graph client.</p>
<script>
var logoURL = "https://static2.sharepointonline.com/files/fabric-cdn-prod_20200430.002/assets/brand-icons/product/svg/teams_48x1.svg";
var currentScript = document.currentScript;
props.context.msGraphClientFactory
.getClient()
.then((client) => {
client
.api("me/joinedTeams")
.version("v1.0")
.get((err, res) => {
if (res) {
let items = res.value.map(team => `<li><img src="${logoURL}" style="width:24px;"/> ${team.displayName}</li>`);
const newDiv = document.createElement('div');
newDiv.innerHTML = `<div>You are a member of ${items.length} teams:</div><ul style="list-style-type: none; columns: 3;">${items.join("")}</ul>`;
currentScript.insertAdjacentElement('afterend', newDiv);
}
});
});
</script>
</div>