アクティビティタイプディスクリプタロケーターAPI

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

アクティビティタイプDescriptor Locator API(Descriptor Locator API)を使って、IDや分類でディスクリプタを取得することができます。Sitecoreのサービスロケーターを使ってDescriptor Locator APIのインスタンスを取得してください:

using Sitecore.DependencyInjection; using Sitecore.Xdb.Locators.AutomationPlans; using Microsoft.Extensions.DependencyInjection;

namespace Documentation { public class ActivityLocatorService { public void Example() { var locatorService = ServiceLocator.ServiceProvider.GetService(); } } }

!注アクティビティタイプディスクリプタのロケーター APIはマーケティングオペレーションAPIとは別です。アクティビティタイプディスクリプタは実装型の登録を表し、開発者によって作成されます。マーケティングオペレーションAPIで管理される定義はマーケターによって作成されます。

IDでアクティビティタイプディスクリプタを取得する

.GetDescriptor()メソッドを使ってIDでディスクリプタを取得します。IDはSitecoreにおけるディスクリプタ項目のIDに対応します。

using Sitecore.DependencyInjection; using Microsoft.Extensions.DependencyInjection; using System; using Sitecore.Xdb.MarketingAutomation.Locators.AutomationPlans; using Sitecore.Xdb.MarketingAutomation.Locators.AutomationPlans.Model;

namespace Documentation { public class ActivityLocatorCreate { public void Example() { var locatorService = ServiceLocator.ServiceProvider.GetService();

var locatorId = Guid.Parse("{743489A2-8BD0-49ED-B284-5534AC59685A}"); // Item ID

IActivityDescriptor descriptor = locatorService.GetDescriptor(locatorId, new System.Globalization.CultureInfo("dk")); } } }

すべてのアクティビティタイプの記述子を取得します

.GetAllDescriptors()メソッドを使ってすべてのアクティビティタイプを取得してください。結果はページ分けが可能です。

using Sitecore.DependencyInjection; using Microsoft.Extensions.DependencyInjection; using System; using Sitecore.Marketing.Core; using Sitecore.Xdb.MarketingAutomation.Locators.AutomationPlans.Model; using Sitecore.Xdb.MarketingAutomation.Locators.AutomationPlans;

namespace Documentation { public class ActivityLocatorGetAll { public void Example() { var locatorService = ServiceLocator.ServiceProvider.GetService();

// Get first 200 descriptors with 'DK' culture ResultSet descriptors = locatorService.GetAllDescriptors(new System.Globalization.CultureInfo("dk"), 1, 200);

// Cycle through results var firstPage = descriptors.DataPage; var total = descriptors.Total;

foreach (var descriptor in firstPage) { var nameOfDescriptor = descriptor.Name; }

} } }

分類によるアクティビティタイプ記述子を取得する

.GetDescriptorsByClassification()メソッドを使って、特定のタクソノミー値が割り当てられたすべてのアクティビティタイプ記述子を取得します。

using Sitecore.DependencyInjection; using Microsoft.Extensions.DependencyInjection; using System; using Sitecore.Marketing.Core; using Sitecore.Xdb.MarketingAutomation.Locators.AutomationPlans;

namespace Documentation { public class ActivityLocatorGetByClassification { public void Example() { var locatorService = ServiceLocator.ServiceProvider.GetService();

var taxonomyId = Guid.Parse("{340062A7-9F50-4CE1-8A53-DA3F6A23B73A}"); // Activity functional type taxonomy var taxonomyValue = Guid.Parse("{144EEBB0-1CD1-4DEA-95A7-04D24D16FDC0}"); // Marketing action value

var descriptors = locatorService.GetDescriptorsByClassification(new System.Globalization.CultureInfo("dk"), taxonomyId, taxonomyValue, 1, 20);

var pageData = descriptors.DataPage;

foreach (var descriptor in pageData) { var name = descriptor.Name; } } } }

!重要パフォーマンスの理由から、ルートの分類法の提供と値の付け合わせGuid Guid。

この記事を改善するための提案がある場合は、 お知らせください!