Tableau Migration SDK 5.1.1
  • Articles
  • Code Samples
  • Python API Reference
  • C# API Reference
Show / Hide Table of Contents
  • Filters
    • Filter projects by name
    • Filter users by SiteRole
    • Filter Custom Views by 'Shared' flag
  • Mappings
    • Username email
    • Rename projects
    • Change projects
  • Transformers
    • Add tags to content
    • Encrypt Extracts
    • Adjust 'Start At' to Scheduled Tasks
    • Change default users for Custom Views
    • Action URL XML Transformer
  • Post-Publish Hooks
    • Update permissions
  • Bulk Post-Publish Hooks
    • Bulk logging
  • Batch Migration Completed Hooks
    • Batch migration logging
  • Migration Action Completed Hooks
    • Migration action logging

Sample: Filter Custom Views by Shared Status

In this example, the custom views currently shared to all users are excluded from migration.

  • Python
  • C#

Filter Class

from tableau_migration import (
    ICustomView,
    ContentMigrationItem,
    ContentFilterBase)
    

class SharedCustomViewFilter(ContentFilterBase[ICustomView]):
    def should_migrate(self, item: ContentMigrationItem[ICustomView]) -> bool:
        if item.source_item.shared == True:
            return False
        return True

Registration

Learn more.

plan_builder.filters.add(SharedCustomViewFilter)

Filter Class

public class SharedCustomViewFilter : ContentFilterBase<ICustomView>
{
    public SharedCustomViewFilter(
        ISharedResourcesLocalizer localizer,
        ILogger<IContentFilter<ICustomView>> logger)
            : base(localizer, logger) { }

    public override bool ShouldMigrate(ContentMigrationItem<ICustomView> item)
    {
        return !item.SourceItem.Shared;
    }
}

Registration

Learn more.

_planBuilder.Filters.Add<SharedCustomViewFilter, ICustomView>();

Dependency Injection

Learn more.

services.AddScoped<SharedCustomViewFilter>();
  • Edit this page
In this article