示例#1
0
        public async Task <TeamGroupDetail> GetTeamGroupDetail([FromBody] string groupId)
        {
            var teamGroupDetail = new TeamGroupDetail();

            var authService = new AuthService(ServiceHelper.Authority);
            var authResult  = await authService.AuthenticateSilently(ServiceHelper.GraphResource);

            if (authResult != null)
            {
                var graphService = new GraphService();
                var teamGroup    = await graphService.GetTeamGroupSPUrl(authResult.AccessToken, groupId);

                teamGroupDetail.Id          = groupId;
                teamGroupDetail.Name        = teamGroup.Name;
                teamGroupDetail.DisplayName = teamGroup.DisplayName;
                teamGroupDetail.Description = teamGroup.Description;
                teamGroupDetail.WebUrl      = teamGroup.WebUrl;

                var imageBytes = await graphService.GetGroupPhoto(authResult.AccessToken, groupId);

                if (imageBytes != null)
                {
                    var picUrl = Convert.ToBase64String(imageBytes);
                    teamGroupDetail.PhotoByteUrl = picUrl;
                }

                return(teamGroupDetail);
            }

            return(null);
        }
示例#2
0
        public async Task <List <TeamChannel> > GetTeamChannels([FromBody] string groupId)
        {
            var teamGroupDetail = new TeamGroupDetail();

            var authService = new AuthService(ServiceHelper.Authority);
            var authResult  = await authService.AuthenticateSilently(ServiceHelper.GraphResource);

            if (authResult != null)
            {
                var graphService = new GraphService();
                var teamChannels = await graphService.GetChannels(authResult.AccessToken, groupId);

                return(teamChannels);
            }

            return(null);
        }