public static async Task Run([ActivityTrigger] CreationResult input, ILogger log, ExecutionContext context)
        {
            log.LogInformation("creating library tabs for client");
            var client     = GraphServiceClientFactory.GetInstance(context?.FunctionAppDirectory).Client.Value;
            var tabService = new TeamsTabService(client, AppDefId);

            await AddConfiguredLibTabsToChannel(input.GroupId, input.ProjectChannelId, input.ProjectSiteUrl, client, tabService, input.ProjectChannelLibTabsLibNames, webExtraction);

            log.LogInformation("created library tabs for client");
        }
コード例 #2
0
        protected static async Task AddConfiguredLibTabsToChannel(string groupId, string channelId, string targetSiteOrSiteCollectionUrl, GraphServiceClient client, TeamsTabService tabService, List <string> librariesNames, Regex executer)
        {
            bool validation(string sectionName, TeamsTab x) => x.DisplayName == sectionName;

            var hostNameAndPath = getSiteHostNameAndPath(executer, targetSiteOrSiteCollectionUrl);
            var site            = await getTargetSite(client, hostNameAndPath);

            foreach (var libraryName in librariesNames)
            {
                var libraryServerRelativeUrl = await getTargetLibrary(client, libraryName, hostNameAndPath.Item1, site);

                if (!await tabService.DoesTabExist(groupId, channelId, (x) => validation(libraryName, x)) && !string.IsNullOrEmpty(libraryServerRelativeUrl))
                {
                    await tabService.AddTab(groupId, channelId, libraryName, getTabConfiguration($"https://{hostNameAndPath.Item1}{hostNameAndPath.Item2}", $"/{WebUtility.UrlEncode(libraryName)}"));
                }
            }
        }