Search Results for

    Show / Hide Table of Contents

    Class CacheManager

    Caching manager, singleton Important: don't cache SharePoint Client objects as these are tied to a specific client context and hence will fail when there's context switching!

    Inheritance
    System.Object
    CacheManager
    Namespace: PnP.Framework.Modernization.Cache
    Assembly: PnP.Framework.dll
    Syntax
    public sealed class CacheManager : object

    Properties

    Instance

    Gets the single cachemanager instance, singleton pattern

    Declaration
    public static CacheManager Instance { get; }
    Property Value
    CacheManager

    Store

    Declaration
    public IDistributedCache Store { get; set; }
    Property Value
    IDistributedCache

    StoreOptions

    Declaration
    public ICacheOptions StoreOptions { get; set; }
    Property Value
    ICacheOptions

    Methods

    AddAssetTransferredEntity(AssetTransferredEntity)

    Declaration
    public void AddAssetTransferredEntity(AssetTransferredEntity asset)
    Parameters
    AssetTransferredEntity asset

    AddMappedUser(String, String)

    Adds a user to the dictionary of mapped users

    Declaration
    public void AddMappedUser(string principal, string user)
    Parameters
    System.String principal

    Principal to map

    System.String user

    mapped user

    ClearAllCaches()

    Clear all the caches

    Declaration
    public void ClearAllCaches()

    ClearBaseTemplate()

    Clear base template cache

    Declaration
    public void ClearBaseTemplate()

    ClearClientSideComponents()

    Clear the clientside component cache

    Declaration
    public void ClearClientSideComponents()

    ClearFieldsToCopy()

    Clear the fields to copy cache

    Declaration
    public void ClearFieldsToCopy()

    ClearGeneratedPageLayoutMappings()

    Clears the cache of generated page layout mappings

    Declaration
    public void ClearGeneratedPageLayoutMappings()

    ClearSharePointVersions()

    Clears Cached SharePoint versions

    Declaration
    public void ClearSharePointVersions()

    GetAADTenantId(Uri)

    Returns the used AzureAD tenant id

    Declaration
    public Guid GetAADTenantId(Uri site)
    Parameters
    Uri site

    Url of the site

    Returns
    Guid

    Azure AD tenant id

    GetAssetsTransferred()

    Declaration
    public List<AssetTransferredEntity> GetAssetsTransferred()
    Returns
    List<AssetTransferredEntity>

    GetBaseTemplate(Web)

    Gets the base template that will be used to filter out "OOB" fields

    Declaration
    public ProvisioningTemplate GetBaseTemplate(Web web)
    Parameters
    Web web

    web to operate against

    Returns
    ProvisioningTemplate

    Provisioning template of the base template of STS#0

    GetBlogListName(ClientContext)

    Get translation for the blog list name

    Declaration
    public string GetBlogListName(ClientContext context)
    Parameters
    ClientContext context

    Context of the site

    Returns
    System.String

    Translated name of the blog list

    GetContentTypeId(List, String)

    Gets the ID of a contenttype

    Declaration
    public string GetContentTypeId(List pagesLibrary, string contentTypeName)
    Parameters
    List pagesLibrary

    Pages library holding the content type

    System.String contentTypeName

    Name of the content type

    Returns
    System.String

    ID of the content type

    GetEnsuredUser(ClientContext, String)

    Run and cache the output value of EnsureUser for a given user

    Declaration
    public ResolvedUser GetEnsuredUser(ClientContext context, string userValue)
    Parameters
    ClientContext context

    ClientContext to operate on

    System.String userValue

    User name of user to ensure

    Returns
    ResolvedUser

    ResolvedUser instance holding information about the ensured user

    GetExactSharePointVersion(Uri)

    Gets the exact SharePoint version from cache

    Declaration
    public string GetExactSharePointVersion(Uri site)
    Parameters
    Uri site

    Site to get the exact version for

    Returns
    System.String

    Exact version from cache

    GetFieldsToCopy(Web, List, String)

    Get the list of fields that need to be copied from cache. If cache is empty the list will be calculated

    Declaration
    public List<FieldData> GetFieldsToCopy(Web web, List sourceLibrary, string pageType)
    Parameters
    Web web

    Web to operate against

    List sourceLibrary

    Pages library instance

    System.String pageType

    Type of page

    Returns
    List<FieldData>

    List of fields that need to be copied

    GetLastUsedTransformator()

    Gets the last used page transformator instance

    Declaration
    public BasePageTransformator GetLastUsedTransformator()
    Returns
    BasePageTransformator

    GetMappedUsers()

    Mapped users

    Declaration
    public Dictionary<string, string> GetMappedUsers()
    Returns
    Dictionary<System.String, System.String>

    A dictionary of mapped users

    GetPageLayoutMapping(ListItem)

    Generate pagelayout mapping file for given publishing page

    Declaration
    public PageLayout GetPageLayoutMapping(ListItem page)
    Parameters
    ListItem page

    Publishing page

    Returns
    PageLayout

    Page layout mapping model

    GetPublishingContentTypeField(List, String, String)

    Get field information of a content type field

    Declaration
    public FieldData GetPublishingContentTypeField(List pagesLibrary, string contentTypeId, string fieldName)
    Parameters
    List pagesLibrary

    Pages library list

    System.String contentTypeId

    ID of the content type

    System.String fieldName

    Name of the field to get information from

    Returns
    FieldData

    FieldData object holding field information

    GetPublishingPagesLibraryName(ClientContext)

    Get translation for the publishing pages library

    Declaration
    public string GetPublishingPagesLibraryName(ClientContext context)
    Parameters
    ClientContext context

    Context of the site

    Returns
    System.String

    Translated name of the pages library

    GetResourceString(ClientContext, String)

    Returns the translated value for a resource string

    Declaration
    public string GetResourceString(ClientContext context, string resource)
    Parameters
    ClientContext context

    Context of the site

    System.String resource

    Key of the resource (e.g. $Resources:core,ScriptEditorWebPartDescription;)

    Returns
    System.String

    Translated string

    GetSharePointVersion(Uri)

    Gets the cached SharePoint version for a given site

    Declaration
    public SPVersion GetSharePointVersion(Uri site)
    Parameters
    Uri site

    Site to get the SharePoint version for

    Returns
    SPVersion

    Found SharePoint version or "Unknown" if not found in cache

    GetTermFromId(ClientContext, Guid)

    Return information for the given term

    Declaration
    public string GetTermFromId(ClientContext context, Guid termId)
    Parameters
    ClientContext context

    ClientContext object to operate on

    Guid termId

    Id of the term to lookup

    Returns
    System.String

    Term label

    GetTermMapping(String, IList<ILogObserver>)

    Returns a cached list of mapped items

    Declaration
    public List<TermMapping> GetTermMapping(string mappingFile, IList<ILogObserver> logObservers = null)
    Parameters
    System.String mappingFile

    IList<ILogObserver> logObservers

    Returns
    List<TermMapping>

    GetTransformTermCacheTermById(ClientContext, Guid)

    Get Term from Term Cache

    Declaration
    public TermData GetTransformTermCacheTermById(ClientContext context, Guid termId)
    Parameters
    ClientContext context

    Guid termId

    Returns
    TermData

    GetTransformTermCacheTermByName(ClientContext, String, String)

    Search Cached term by name

    Declaration
    public List<TermData> GetTransformTermCacheTermByName(ClientContext context, string termLabel = "", string termPath = "")
    Parameters
    ClientContext context

    System.String termLabel

    System.String termPath

    Returns
    List<TermData>

    GetTransformTermCacheTermsByTermSet(ClientContext, Guid)

    Get Term by Term Set Id

    Declaration
    public Dictionary<Guid, TermData> GetTransformTermCacheTermsByTermSet(ClientContext context, Guid termSetId)
    Parameters
    ClientContext context

    Guid termSetId

    Returns
    Dictionary<Guid, TermData>

    GetUrlMapping(String, IList<ILogObserver>)

    Returns a list of url mappings

    Declaration
    public List<UrlMapping> GetUrlMapping(string urlMappingFile, IList<ILogObserver> logObservers = null)
    Parameters
    System.String urlMappingFile

    File with url mappings

    IList<ILogObserver> logObservers

    Attached list of log observers

    Returns
    List<UrlMapping>

    List of url mappings

    GetUserFromUserList(ClientContext, Int32)

    Lookup a user from the site's user list based upon the user's id

    Declaration
    public UserEntity GetUserFromUserList(ClientContext context, int userListId)
    Parameters
    ClientContext context

    Context of the web holding the user list

    System.Int32 userListId

    Id of the user to fetch

    Returns
    UserEntity

    A UserEntity instance holding information about the user

    GetUserFromUserList(ClientContext, String)

    Lookup a user from the site's user list based upon the user's upn

    Declaration
    public UserEntity GetUserFromUserList(ClientContext context, string userUpn)
    Parameters
    ClientContext context

    Context of the web holding the user list

    System.String userUpn

    Upn of the user to fetch

    Returns
    UserEntity

    A UserEntity instance holding information about the user

    GetUserMapping(String, IList<ILogObserver>)

    Gets the list of user mappings, if first time file will be laoded

    Declaration
    public List<UserMappingEntity> GetUserMapping(string userMappingFile, IList<ILogObserver> logObservers = null)
    Parameters
    System.String userMappingFile

    File with the user mappings

    IList<ILogObserver> logObservers

    Attached list of log observers

    Returns
    List<UserMappingEntity>

    List of user mappings

    IsBlogWeb(String)

    Checks if this is blog web

    Declaration
    public bool IsBlogWeb(string webUrl)
    Parameters
    System.String webUrl

    Web url to check

    Returns
    System.Boolean

    True if blog, false otherwise

    IsPublishingWeb(String)

    Checks if this is publishing web

    Declaration
    public bool IsPublishingWeb(string webUrl)
    Parameters
    System.String webUrl

    Web url to check

    Returns
    System.Boolean

    True if publishing, false otherwise

    SetAADTenantId(Guid, Uri)

    Sets the Azure AD tenant Id in cache

    Declaration
    public void SetAADTenantId(Guid tenantId, Uri site)
    Parameters
    Guid tenantId

    Tenant Id

    Uri site

    Site url

    SetBlogWeb(String)

    Marks this web as a blog web

    Declaration
    public void SetBlogWeb(string webUrl)
    Parameters
    System.String webUrl

    Url of the web

    SetExactSharePointVersion(Uri, String)

    Adds exact SharePoint version for a given site to cache

    Declaration
    public void SetExactSharePointVersion(Uri site, string version)
    Parameters
    Uri site

    Site to add the SharePoint version for to cache

    System.String version

    Version to add

    SetLastUsedTransformator(BasePageTransformator)

    Caches the last used page transformator instance, needed to postpone log writing when transforming multiple pages

    Declaration
    public void SetLastUsedTransformator(BasePageTransformator transformator)
    Parameters
    BasePageTransformator transformator

    SetPublishingWeb(String)

    Marks this web as a publishing web

    Declaration
    public void SetPublishingWeb(string webUrl)
    Parameters
    System.String webUrl

    Url of the web

    SetSharePointVersion(Uri, SPVersion)

    Sets the SharePoint version in cache

    Declaration
    public void SetSharePointVersion(Uri site, SPVersion version)
    Parameters
    Uri site

    Site to the set the SharePoint version for

    SPVersion version

    SharePoint version of the site

    StoreTermSetTerms(ClientContext, Guid, Guid, Boolean, Boolean)

    Get Term Path by ID

    Declaration
    public void StoreTermSetTerms(ClientContext context, Guid termSetId, Guid sourceSspId, bool isSP2010, bool isSourceTerm)
    Parameters
    ClientContext context

    Guid termSetId

    Guid sourceSspId

    System.Boolean isSP2010

    System.Boolean isSourceTerm

    Extension Methods

    ValidationExtensions.ValidateNotNullOrEmpty<T>(T, String)
    ObjectExtensions.Set<TObject, T>(TObject, Expression<Func<TObject, T>>, T, Boolean, Boolean)
    ObjectExtensions.GetPublicInstancePropertyValue(Object, String)
    ObjectExtensions.GetPublicInstanceProperty(Object, String)
    ObjectExtensions.SetPublicInstancePropertyValue(Object, String, Object)
    Extensions.ToByteArray(Object)
    Back to top PnP Framework
    Generated by DocFX with Material UI
    spacer