Example #1
0
        public override string GetReplaceValue()
        {
            if (string.IsNullOrEmpty(CacheValue))
            {
                TokenContext.Load(TokenContext.Web, w => w.AssociatedOwnerGroup.Title, w => w.AssociatedMemberGroup.Title, w => w.AssociatedVisitorGroup.Title);
                TokenContext.ExecuteQueryRetry();
                switch (_groupType)
                {
                case AssociatedGroupType.owners:
                {
                    CacheValue = TokenContext.Web.AssociatedOwnerGroup.Title;
                    break;
                }

                case AssociatedGroupType.members:
                {
                    CacheValue = TokenContext.Web.AssociatedMemberGroup.Title;
                    break;
                }

                case AssociatedGroupType.visitors:
                {
                    CacheValue = TokenContext.Web.AssociatedVisitorGroup.Title;
                    break;
                }
                }
            }
            return(CacheValue);
        }
Example #2
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Web, w => w.Id);
         TokenContext.ExecuteQueryRetry();
         CacheValue = TokenContext.Web.Id.ToString().Replace("-", "%2D");
     }
     return(CacheValue);
 }
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Web, w => w.Title);
         TokenContext.ExecuteQueryRetry();
         CacheValue = Regex.Replace(TokenContext.Web.Title, "[\"/\\[\\]\\\\:|<>+=;,?*\'@]", "_");
     }
     return(CacheValue);
 }
Example #4
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Site, s => s.Id);
         TokenContext.ExecuteQueryRetry();
         CacheValue = TokenContext.Site.Id.ToString();
     }
     return(CacheValue);
 }
Example #5
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Web, w => w.ServerRelativeUrl);
         TokenContext.ExecuteQueryRetry();
         CacheValue = TokenContext.Web.ServerRelativeUrl.TrimEnd('/');
     }
     return(CacheValue);
 }
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Web, w => w.Title);
         TokenContext.ExecuteQueryRetry();
         CacheValue = TokenContext.Web.Title;
     }
     return(CacheValue);
 }
Example #7
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         var site = TokenContext.Site;
         TokenContext.Load(site, s => s.RootWeb.ServerRelativeUrl);
         TokenContext.ExecuteQueryRetry();
         CacheValue = site.RootWeb.ServerRelativeUrl.TrimEnd('/');
     }
     return(CacheValue);
 }
Example #8
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         var site = TokenContext.Site;
         TokenContext.Load(site, s => s.Owner);
         TokenContext.ExecuteQueryRetry();
         CacheValue = site.Owner.LoginName;
     }
     return(CacheValue);
 }
Example #9
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TaxonomySession session   = TaxonomySession.GetTaxonomySession(TokenContext);
         var             termStore = session.GetDefaultKeywordsTermStore();
         TokenContext.Load(termStore, t => t.Id);
         TokenContext.ExecuteQueryRetry();
         CacheValue = termStore.Id.ToString();
     }
     return(CacheValue);
 }
Example #10
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Site.EnsureProperty(p => p.RootWeb);
         var catalog = TokenContext.Site.RootWeb.GetCatalog((int)ListTemplateType.ThemeCatalog);
         TokenContext.Load(catalog, c => c.RootFolder.ServerRelativeUrl);
         TokenContext.ExecuteQueryRetry();
         CacheValue = catalog.RootFolder.ServerRelativeUrl;
     }
     return CacheValue;
 }
        public override string GetReplaceValue()
        {
            if (string.IsNullOrEmpty(CacheValue))
            {
                // The token is requested. Check if the group exists and if not, create it
                var site      = TokenContext.Site;
                var session   = TaxonomySession.GetTaxonomySession(TokenContext);
                var termstore = session.GetDefaultSiteCollectionTermStore();
                var termGroup = termstore.GetSiteCollectionGroup(site, true);
                TokenContext.Load(termGroup);
                TokenContext.ExecuteQueryRetry();

                CacheValue = termGroup.Id.ToString();
            }
            return(CacheValue);
        }
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Site, s => s.GroupId);
         TokenContext.ExecuteQueryRetry();
         if (TokenContext.Site.GroupId != null && !TokenContext.Site.GroupId.Equals(Guid.Empty))
         {
             CacheValue = TokenContext.Site.GroupId.ToString();
         }
         else
         {
             CacheValue = "";
         }
     }
     return(CacheValue);
 }
Example #13
0
 public override string GetReplaceValue()
 {
     if (string.IsNullOrEmpty(CacheValue))
     {
         if (_listId != null)
         {
             CacheValue = _listId;
         }
         else
         {
             var list = TokenContext.Web.Lists.GetByTitle(_name);
             TokenContext.Load(list, l => l.Id);
             TokenContext.ExecuteQueryRetry();
             _listId    = list.Id.ToString();
             CacheValue = list.Id.ToString();
         }
     }
     return(CacheValue);
 }
        public override string GetReplaceValue()
        {
            if (string.IsNullOrEmpty(CacheValue))
            {
                switch (_groupType)
                {
                case AssociatedGroupType.owners:
                {
                    TokenContext.Load(TokenContext.Web, w => w.AssociatedOwnerGroup.Id);
                    TokenContext.ExecuteQueryRetry();
                    if (!TokenContext.Web.AssociatedOwnerGroup.ServerObjectIsNull.Value)
                    {
                        CacheValue = TokenContext.Web.AssociatedOwnerGroup.Id.ToString();
                    }
                    break;
                }

                case AssociatedGroupType.members:
                {
                    TokenContext.Load(TokenContext.Web, w => w.AssociatedMemberGroup.Id);
                    TokenContext.ExecuteQueryRetry();
                    if (!TokenContext.Web.AssociatedMemberGroup.ServerObjectIsNull.Value)
                    {
                        CacheValue = TokenContext.Web.AssociatedMemberGroup.Id.ToString();
                    }
                    break;
                }

                case AssociatedGroupType.visitors:
                {
                    TokenContext.Load(TokenContext.Web, w => w.AssociatedVisitorGroup.Id);
                    TokenContext.ExecuteQueryRetry();
                    if (!TokenContext.Web.AssociatedVisitorGroup.ServerObjectIsNull.Value)
                    {
                        CacheValue = TokenContext.Web.AssociatedVisitorGroup.Id.ToString();
                    }
                    break;
                }
                }
            }
            return(CacheValue);
        }
Example #15
0
        public override string GetReplaceValue()
        {
            if (string.IsNullOrEmpty(CacheValue))
            {
                try
                {
                    // The token is requested. Check if the group exists and if not, create it
                    var site      = TokenContext.Site;
                    var session   = TaxonomySession.GetTaxonomySession(TokenContext);
                    var termstore = session.GetDefaultSiteCollectionTermStore();
                    var termGroup = termstore.GetSiteCollectionGroup(site, true);
                    TokenContext.Load(termGroup);
                    TokenContext.ExecuteQueryRetry();

                    CacheValue = termGroup.Id.ToString();
                }
                catch (ServerUnauthorizedAccessException)
                {
                    Log.Warning(Constants.LOGGING_SOURCE, CoreResources.TermGroup_No_Access);
                }
            }
            return(CacheValue);
        }
        public override string GetReplaceValue()
        {
            if (this.CacheValue == null)
            {
                List catalog;
                // Check if the current web is a sub-site
                if (TokenContext.Web.IsSubSite())
                {
                    // Master page URL needs to be retrieved from the rootweb
                    var rootWeb = TokenContext.Site.RootWeb;
                    catalog = rootWeb.GetCatalog((int)ListTemplateType.MasterPageCatalog);
                }
                else
                {
                    catalog = TokenContext.Web.GetCatalog((int)ListTemplateType.MasterPageCatalog);
                }

                TokenContext.Load(catalog, c => c.RootFolder.ServerRelativeUrl);
                TokenContext.ExecuteQueryRetry();
                CacheValue = catalog.RootFolder.ServerRelativeUrl;
            }
            return(CacheValue);
        }