Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Web, w => w.Title);
         TokenContext.ExecuteQueryRetry();
         CacheValue = Regex.Replace(TokenContext.Web.Title, "[\"/\\[\\]\\\\:|<>+=;,?*\'@]", "_");
     }
     return(CacheValue);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 6
0
 public override string GetReplaceValue()
 {
     if (CacheValue == null)
     {
         TokenContext.Load(TokenContext.Web, w => w.Title);
         TokenContext.ExecuteQueryRetry();
         CacheValue = TokenContext.Web.Title;
     }
     return(CacheValue);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 16
0
        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);
        }