public List <LocalTermStore> FetchTermStores() { TaxonomySession taxonomySession = this.GetTaxonomySession(); ClientConnectorDownloadOptions options = new ClientConnectorDownloadOptions(); options.MaximumDepth = 0; options.MinimalAtMaximumDepth = true; var retrievals = TermStoreDownloader.GetRetrievalsForMinimalProperties(); this.clientContext.Load(taxonomySession, session => session.TermStores.Include(retrievals)); this.ExecuteQuery(); List <LocalTermStore> list = new List <LocalTermStore>(); foreach (TermStore clientTermStore in taxonomySession.TermStores) { var downloaderContext = new TaxonomyItemDownloaderContext(this, options); TermStoreDownloader termStoreDownloader = new TermStoreDownloader(downloaderContext, clientTermStore); termStoreDownloader.AssignMinimalProperties(); list.Add(termStoreDownloader.LocalObject); } return(list); }
public void Download(LocalTermStore termStore, ClientConnectorDownloadOptions options = null) { if (options == null) { options = new ClientConnectorDownloadOptions(); } TermStore clientTermStore = this.FetchClientTermStore(termStore.Id); // Load full data for the TermStore object var downloaderContext = new TaxonomyItemDownloaderContext(this, options); TermStoreDownloader termStoreDownloader = new TermStoreDownloader(downloaderContext, clientTermStore); termStoreDownloader.SetLocalObject(termStore); termStoreDownloader.FetchItem(); }
public TaxonomyItemDownloader(TaxonomyItemDownloaderContext downloaderContext, TClient clientObject, int treeDepth) { ToolkitUtilities.ConfirmNotNull(downloaderContext, "downloaderContext"); ToolkitUtilities.ConfirmNotNull(clientObject, "clientObject"); if (clientObject.Context != downloaderContext.ClientConnector.ClientContext) { throw new ArgumentException("The specified clientObject is not associated with a Client15Connector", "clientObject"); } this.downloaderContext = downloaderContext; this.clientObject = clientObject; this.treeDepth = treeDepth; }
public TermSetDownloader(TaxonomyItemDownloaderContext downloaderContext, TermSet clientObject, int treeDepth) : base(downloaderContext, clientObject, treeDepth) { }
public TermStoreDownloader(TaxonomyItemDownloaderContext downloaderContext, TermStore clientObject) : base(downloaderContext, clientObject, treeDepth: 0) { this.DownloaderContext.TermStoreDownloader = this; }