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
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
Store
Declaration
public IDistributedCache Store { get; set; }
Property Value
IDistributed
|
StoreOptions
Methods
AddAssetTransferredEntity(AssetTransferredEntity)
Declaration
public void AddAssetTransferredEntity(AssetTransferredEntity asset)
Parameters
Asset
|
AddMappedUser(String, String)
Adds a user to the dictionary of mapped users
Declaration
public void AddMappedUser(string principal, string user)
Parameters
System. Principal to map |
System. 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()
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<Asset
|
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
Provisioning 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
Client Context of the site |
Returns
System. 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. Name of the content type |
Returns
System. 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
Client ClientContext to operate on |
System. User name of user to ensure |
Returns
Resolved ResolvedUser instance holding information about the ensured user |
GetExactSharePointVersion(Uri)
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. Type of page |
Returns
List<Field List of fields that need to be copied |
GetLastUsedTransformator()
Gets the last used page transformator instance
Declaration
public BasePageTransformator GetLastUsedTransformator()
Returns
GetMappedUsers()
Mapped users
Declaration
public Dictionary<string, string> GetMappedUsers()
Returns
Dictionary<System. A dictionary of mapped users |
GetPageLayoutMapping(ListItem)
Generate pagelayout mapping file for given publishing page
Declaration
public PageLayout GetPageLayoutMapping(ListItem page)
Parameters
List Publishing page |
Returns
Page 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. ID of the content type |
System. Name of the field to get information from |
Returns
Field FieldData object holding field information |
GetPublishingPagesLibraryName(ClientContext)
Get translation for the publishing pages library
Declaration
public string GetPublishingPagesLibraryName(ClientContext context)
Parameters
Client Context of the site |
Returns
System. 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
Client Context of the site |
System. Key of the resource (e.g. $Resources:core,ScriptEditorWebPartDescription;) |
Returns
System. Translated string |
GetSharePointVersion(Uri)
GetTermFromId(ClientContext, Guid)
Return information for the given term
Declaration
public string GetTermFromId(ClientContext context, Guid termId)
Parameters
Client ClientContext object to operate on |
Guid
termId
Id of the term to lookup |
Returns
System. 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.
|
IList<ILog
|
Returns
List<Term
|
GetTransformTermCacheTermById(ClientContext, Guid)
Get Term from Term Cache
Declaration
public TermData GetTransformTermCacheTermById(ClientContext context, Guid termId)
Parameters
Client
|
Guid
termId
|
Returns
GetTransformTermCacheTermByName(ClientContext, String, String)
Search Cached term by name
Declaration
public List<TermData> GetTransformTermCacheTermByName(ClientContext context, string termLabel = "", string termPath = "")
Parameters
Client
|
System.
|
System.
|
Returns
List<Term
|
GetTransformTermCacheTermsByTermSet(ClientContext, Guid)
Get Term by Term Set Id
Declaration
public Dictionary<Guid, TermData> GetTransformTermCacheTermsByTermSet(ClientContext context, Guid termSetId)
Parameters
Client
|
Guid
termSetId
|
Returns
Dictionary<Guid, Term
|
GetUrlMapping(String, IList<ILogObserver>)
Returns a list of url mappings
Declaration
public List<UrlMapping> GetUrlMapping(string urlMappingFile, IList<ILogObserver> logObservers = null)
Parameters
System. File with url mappings |
IList<ILog Attached list of log observers |
Returns
List<Url 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
Client Context of the web holding the user list |
System. Id of the user to fetch |
Returns
User 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
Client Context of the web holding the user list |
System. Upn of the user to fetch |
Returns
User 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. File with the user mappings |
IList<ILog Attached list of log observers |
Returns
List<User List of user mappings |
IsBlogWeb(String)
Checks if this is blog web
Declaration
public bool IsBlogWeb(string webUrl)
Parameters
System. Web url to check |
Returns
System. True if blog, false otherwise |
IsPublishingWeb(String)
Checks if this is publishing web
Declaration
public bool IsPublishingWeb(string webUrl)
Parameters
System. Web url to check |
Returns
System. 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. Url of the web |
SetExactSharePointVersion(Uri, String)
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
Base
|
SetPublishingWeb(String)
Marks this web as a publishing web
Declaration
public void SetPublishingWeb(string webUrl)
Parameters
System. Url of the web |
SetSharePointVersion(Uri, SPVersion)
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
Client
|
Guid
termSetId
|
Guid
sourceSspId
|
System.
|
System.
|