Esempio n. 1
0
        private static string CreateTeamTab(PnPMonitoredScope scope, TeamTab tab, string teamId, string channelId, string accessToken)
        {
            var tabToCreate = new
            {
                tab.DisplayName,
                tab.TeamsAppId,
                configuration = tab.Configuration != null
                    ? new
                {
                    tab.Configuration.EntityId,
                    tab.Configuration.ContentUrl,
                    tab.Configuration.RemoveUrl,
                    tab.Configuration.WebsiteUrl
                }
                    : null
            };

            var tabId = GraphHelper.CreateOrUpdateGraphObject(scope,
                                                              HttpMethodVerb.POST,
                                                              $"{GraphHelper.MicrosoftGraphBaseURI}beta/teams/{teamId}/channels/{channelId}/tabs",
                                                              tabToCreate,
                                                              HttpHelper.JsonContentType,
                                                              accessToken,
                                                              "NameAlreadyExists",
                                                              CoreResources.Provisioning_ObjectHandlers_Teams_Team_TabAlreadyExists,
                                                              "displayName",
                                                              tab.DisplayName,
                                                              CoreResources.Provisioning_ObjectHandlers_Teams_Team_ProvisioningError,
                                                              false);

            return(tabId);
        }
Esempio n. 2
0
        private static string UpdateTeamTab(TeamTab tab, string teamId, string channelId, string tabId, string accessToken)
        {
            // teamsAppId is not allowed in the request
            var teamsAppId = tab.TeamsAppId;

            tab.TeamsAppId = null;

            // Prepare the request body for the Tab update
            var tabToUpdate = new
            {
                displayName   = tab.DisplayName,
                configuration = tab.Configuration != null
                    ? new
                {
                    entityId   = tab.Configuration.EntityId,
                    contentUrl = tab.Configuration.ContentUrl,
                    removeUrl  = tab.Configuration.RemoveUrl,
                    websiteUrl = tab.Configuration.WebsiteUrl,
                } : null,
            };

            HttpHelper.MakePatchRequestForString($"{GraphHelper.MicrosoftGraphBaseURI}beta/teams/{teamId}/channels/{channelId}/tabs/{tabId}", tabToUpdate, HttpHelper.JsonContentType, accessToken);

            // Add the teamsAppId back now that we've updated the tab
            tab.TeamsAppId = teamsAppId;

            return(tabId);
        }
Esempio n. 3
0
    public void ChangeTeamTab(TeamTab Tab)
    {
        if (m_TabController == null)
        {
            return;
        }
        switch (Tab)
        {
        case TeamTab.TeamTab_TeamInfo:
        {
            m_TabController.ChangeTab("0");
        }
        break;

        case TeamTab.TeamTab_NearPlayer:
        {
            m_TabController.ChangeTab("1");
        }
        break;

        case TeamTab.TeamTab_NearTeam:
        {
            m_TabController.ChangeTab("2");
        }
        break;

        default:
        {
            break;
        }
        }
    }
        /// <summary>
        /// Initializes the platform
        /// </summary>
        private static void InitializePlatform()
        {
            RefreshAppList();

            if (Enjin.AppID != -1)
            {
                RefreshUserRoles();
                _settingsTab = new SettingsTab(SkinTheme);
                EditorUtility.DisplayProgressBar("Loading", "Loading Team List", 0.5f);
                _teamTab = new TeamTab(SkinTheme);
                EditorUtility.DisplayProgressBar("Loading", "Loading Identities List", 0.6f);
                _identitiesTab = new IdentitiesTab(SkinTheme);
                EditorUtility.DisplayProgressBar("Loading", "Loading CryptoItems List", 0.7f);
                _CryptoItemsTab = new CryptoItemsTab(SkinTheme);
                EditorUtility.DisplayProgressBar("Loading", "Loading Settings", 1.0f);
                _walletTab = new WalletTab(SkinTheme);
                EditorUtility.ClearProgressBar();
            }
        }
Esempio n. 5
0
        public static TeamTab AddTab(HttpClient httpClient, string accessToken, string groupId, string channelId, string displayName, TeamTabType tabType, string teamsAppId, string entityId, string contentUrl, string removeUrl, string websiteUrl)
        {
            TeamTab tab = new TeamTab();

            tab.Configuration = new TeamTabConfiguration();
            switch (tabType)
            {
            case TeamTabType.Custom:
            {
                tab.TeamsAppId               = teamsAppId;
                tab.Configuration.EntityId   = entityId;
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = removeUrl;
                tab.Configuration.WebsiteUrl = websiteUrl;
                break;
            }

            case TeamTabType.DocumentLibrary:
            {
                tab.TeamsAppId               = "com.microsoft.teamspace.tab.files.sharepoint";
                tab.Configuration.EntityId   = "";
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = null;
                tab.Configuration.WebsiteUrl = null;
                break;
            }

            case TeamTabType.WebSite:
            {
                tab.TeamsAppId               = "com.microsoft.teamspace.tab.web";
                tab.Configuration.EntityId   = null;
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = null;
                tab.Configuration.WebsiteUrl = contentUrl;
                break;
            }

            case TeamTabType.Word:
            {
                tab.TeamsAppId               = "com.microsoft.teamspace.tab.file.staticviewer.word";
                tab.Configuration.EntityId   = entityId;
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = null;
                tab.Configuration.WebsiteUrl = null;
                break;
            }

            case TeamTabType.Excel:
            {
                tab.TeamsAppId               = "com.microsoft.teamspace.tab.file.staticviewer.excel";
                tab.Configuration.EntityId   = entityId;
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = null;
                tab.Configuration.WebsiteUrl = null;
                break;
            }

            case TeamTabType.PowerPoint:
            {
                tab.TeamsAppId               = "com.microsoft.teamspace.tab.file.staticviewer.powerpoint";
                tab.Configuration.EntityId   = entityId;
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = null;
                tab.Configuration.WebsiteUrl = null;
                break;
            }

            case TeamTabType.PDF:
            {
                tab.TeamsAppId               = "com.microsoft.teamspace.tab.file.staticviewer.pdf";
                tab.Configuration.EntityId   = entityId;
                tab.Configuration.ContentUrl = contentUrl;
                tab.Configuration.RemoveUrl  = null;
                tab.Configuration.WebsiteUrl = null;
                break;
            }

            case TeamTabType.Wiki:
            {
                tab.TeamsAppId = "com.microsoft.teamspace.tab.wiki";
                break;
            }

            case TeamTabType.Planner:
            {
                tab.TeamsAppId = "com.microsoft.teamspace.tab.planner";
                break;
            }

            case TeamTabType.MicrosoftStream:
            {
                tab.TeamsAppId = "com.microsoftstream.embed.skypeteamstab";
                break;
            }

            case TeamTabType.MicrosoftForms:
            {
                tab.TeamsAppId = "81fef3a6-72aa-4648-a763-de824aeafb7d";
                break;
            }

            case TeamTabType.OneNote:
            {
                tab.TeamsAppId = "0d820ecd-def2-4297-adad-78056cde7c78";
                break;
            }

            case TeamTabType.PowerBI:
            {
                tab.TeamsAppId = "com.microsoft.teamspace.tab.powerbi";
                break;
            }

            case TeamTabType.SharePointPageAndList:
            {
                tab.TeamsAppId = "2a527703-1f6f-4559-a332-d8a7d288cd88";
                break;
            }
            }
            tab.DisplayName = displayName;
            tab.TeamsApp    = $"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{tab.TeamsAppId}";
            return(GraphHelper.PostAsync <TeamTab>(httpClient, $"v1.0/teams/{groupId}/channels/{channelId}/tabs", tab, accessToken).GetAwaiter().GetResult());
        }
Esempio n. 6
0
 public static void UpdateTab(HttpClient httpClient, string accessToken, string groupId, string channelId, TeamTab tab)
 {
     tab.Configuration = null;
     GraphHelper.PatchAsync(httpClient, accessToken, $"v1.0/teams/{groupId}/channels/{channelId}/tabs/{tab.Id}", tab).GetAwaiter().GetResult();
 }
Esempio n. 7
0
 public static async Task UpdateTabAsync(HttpClient httpClient, string accessToken, string groupId, string channelId, TeamTab tab)
 {
     tab.Configuration = null;
     await GraphHelper.PatchAsync(httpClient, accessToken, $"v1.0/teams/{groupId}/channels/{channelId}/tabs/{tab.Id}", tab);
 }
Esempio n. 8
0
        public void Initialize()
        {
            if (!TestCommon.AppOnlyTesting())
            {
                const string teamTemplateName = "Sample Engineering Team";
                _teamNames.Add(teamTemplateName);
                _jsonTemplate = "{ \"[email protected]\": \"https://graph.microsoft.com/beta/teamsTemplates(\'standard\')\", \"visibility\": \"Private\", \"displayName\": \"" + teamTemplateName + "\", \"description\": \"This is a sample engineering team, used to showcase the range of properties supported by this API\", \"channels\": [ { \"displayName\": \"Announcements 📢\", \"isFavoriteByDefault\": true, \"description\": \"This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements.\" }, { \"displayName\": \"Training 🏋️\", \"isFavoriteByDefault\": true, \"description\": \"This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs.\", \"tabs\": [ { \"[email protected]\": \"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.web\')\", \"name\": \"A Pinned Website\", \"configuration\": { \"contentUrl\": \"https://docs.microsoft.com/en-us/microsoftteams/microsoft-teams\" } }, { \"[email protected]\": \"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.youtube\')\", \"name\": \"A Pinned YouTube Video\", \"configuration\": { \"contentUrl\": \"https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ\", \"websiteUrl\": \"https://www.youtube.com/watch?v=X8krAMdGvCQ\" } } ] }, { \"displayName\": \"Planning 📅 \", \"description\": \"This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.\", \"isFavoriteByDefault\": false }, { \"displayName\": \"Issues and Feedback 🐞\", \"description\": \"This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.\" } ], \"memberSettings\": { \"allowCreateUpdateChannels\": true, \"allowDeleteChannels\": true, \"allowAddRemoveApps\": true, \"allowCreateUpdateRemoveTabs\": true, \"allowCreateUpdateRemoveConnectors\": true }, \"guestSettings\": { \"allowCreateUpdateChannels\": false, \"allowDeleteChannels\": false }, \"funSettings\": { \"allowGiphy\": true, \"giphyContentRating\": \"Moderate\", \"allowStickersAndMemes\": true, \"allowCustomMemes\": true }, \"messagingSettings\": { \"allowUserEditMessages\": true, \"allowUserDeleteMessages\": true, \"allowOwnerDeleteMessages\": true, \"allowTeamMentions\": true, \"allowChannelMentions\": true }, \"installedApps\": [ { \"[email protected]\": \"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.vsts\')\" }, { \"[email protected]\": \"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'1542629c-01b3-4a6d-8f76-1938b779e48d\')\" } ] }";

                const string teamName = @"Unallowed &_,.;:/\""!@$%^*[]+=&'|<>{}-()?#¤`´~¨ Ääkköset";
                _teamNames.Add(teamName);
                var security = new TeamSecurity
                {
                    AllowToAddGuests = false,
                    Owners           = { new TeamSecurityUser {
                                             UserPrincipalName = ConfigurationManager.AppSettings["SPOUserName"]
                                         } }
                };
                var funSettings = new TeamFunSettings
                {
                    AllowCustomMemes      = true,
                    AllowGiphy            = true,
                    AllowStickersAndMemes = true,
                    GiphyContentRating    = TeamGiphyContentRating.Moderate
                };
                var guestSettings = new TeamGuestSettings
                {
                    AllowCreateUpdateChannels = false,
                    AllowDeleteChannels       = false
                };
                var memberSettings = new TeamMemberSettings
                {
                    AllowDeleteChannels               = false,
                    AllowAddRemoveApps                = true,
                    AllowCreateUpdateChannels         = true,
                    AllowCreateUpdateRemoveConnectors = false,
                    AllowCreateUpdateRemoveTabs       = true
                };
                var messagingSettings = new TeamMessagingSettings
                {
                    AllowChannelMentions     = true,
                    AllowOwnerDeleteMessages = true,
                    AllowTeamMentions        = false,
                    AllowUserDeleteMessages  = true,
                    AllowUserEditMessages    = true
                };
                var channel = new TeamChannel
                {
                    DisplayName         = "Another channel",
                    Description         = "Another channel description!",
                    IsFavoriteByDefault = true
                };
                var tab = new TeamTab
                {
                    DisplayName = "OneNote Tab",
                    TeamsAppId  = "0d820ecd-def2-4297-adad-78056cde7c78"/*,
                                                                         * Configuration = new TeamTabConfiguration
                                                                         * {
                                                                         * ContentUrl = "https://todo-improve-this-test-when-tab-resource-provisioning-has-been-implemented"
                                                                         * }*/
                };
                channel.Tabs.Add(tab);
                var message = new TeamChannelMessage
                {
                    Message = "Welcome to this awesome new channel!"
                };
                channel.Messages.Add(message);

                _team = new Team {
                    DisplayName = teamName, Description = "Testing creating mailNickname from a display name that has unallowed and accented characters", Visibility = TeamVisibility.Public, Security = security, FunSettings = funSettings, GuestSettings = guestSettings, MemberSettings = memberSettings, MessagingSettings = messagingSettings, Channels = { channel }
                };
            }
        }
 public TeamsTabPipeBind(TeamTab tab)
 {
     _tab = tab;
 }