示例#1
0
        /// <summary>
        /// Apply build-in tag to group with specific id
        /// </summary>
        /// <param name="tagId">tag id</param>
        /// <param name="groupId">group id</param>
        public void ApplyBuildInTagToGroup(String tagId, String groupId)
        {
            var tagService      = GroupHubApi.Create <ITagService>();
            var buildInTag      = tagService.Get(tagId);
            var tagGroupService = GroupHubApi.Create <IGroupTagService>();

            tagGroupService.Save(groupId, buildInTag);
        }
        /// <summary>
        /// Save one build-in tag with specific name and description
        /// </summary>
        /// <param name="name">tag name</param>
        /// <param name="description">tag description</param>
        /// <returns></returns>
        public TagModel SaveBuildInTag(String name, String description)
        {
            var      tagService = GroupHubApi.Create <ITagService>();
            TagModel tag        = tagService.Save(new TagModel()
            {
                Name        = name,
                Description = description,
                Type        = 1
            });

            return(tag);
        }
        /// <summary>
        /// Update one build-in tag with specific name and description
        /// </summary>
        /// <param name="originalName">original name</param>
        /// <param name="newName">new name</param>
        /// <param name="description">new description</param>
        public void UpdateBuildInTag(String originalName, String newName, String description)
        {
            var tagService  = GroupHubApi.Create <ITagService>();
            var allTags     = tagService.Get();
            var selectedTag = allTags.ToList().Find(item => item.Name.Equals(originalName) && item.Type == 1);

            if (selectedTag != null)
            {
                selectedTag.Name        = newName;
                selectedTag.Description = description;
                tagService.Update(selectedTag.Id, selectedTag);
            }
        }
示例#4
0
        /// <summary>
        /// Init Group Hub api service, when invoking this, it will prompt a logon window, customer need to input the password
        /// </summary>
        /// <param name="region">region of your tenant</param>
        /// <param name="office365TenantId">office 365 tenant id of your tenant</param>
        /// <param name="userName">your user name</param>
        private static void Initilize(Region region, String office365TenantId, String userName)
        {
            var clientId              = "d3590ed6-52b3-4102-aeff-aad2292ab01c";
            var redirectUri           = "urn:ietf:wg:oauth:2.0:oob";
            var resource              = "https://graph.microsoft.com";
            var authority             = $"https://login.windows.net/{office365TenantId}";
            var authenticationContext = new AuthenticationContext(authority);
            var userId = new UserIdentifier(userName, UserIdentifierType.OptionalDisplayableId);
            var result = authenticationContext.AcquireToken(resource, clientId, new Uri(redirectUri), PromptBehavior.Always, userId);
            AuthenticationTokenModel model = new AuthenticationTokenModel();

            model.AccessToken  = result.AccessToken;
            model.RefreshToken = result.RefreshToken;
            GroupHubApi.Init(region, model);
        }
示例#5
0
        /// <summary>
        /// Remove build-in tag from group with specific id
        /// </summary>
        /// <param name="tagId">tag id</param>
        /// <param name="groupId">group id</param>
        public void UnRegisterBuildInTagFromGroup(String tagId, String groupId)
        {
            var tagGroupService = GroupHubApi.Create <IGroupTagService>();

            tagGroupService.Delete(groupId, tagId);
        }
        /// <summary>
        /// Delete one build-in tag with specific tag id
        /// </summary>
        /// <param name="tagId">tag id</param>
        public void DeleteBuildInTag(String tagId)
        {
            var tagService = GroupHubApi.Create <ITagService>();

            tagService.Delete(tagId);
        }