人々はカタログ アイテムを承認のために送信する必要があり、他のユーザーが使用できるようにするには管理者がそれを承認する必要があります。
カタログに送信するには、次が必要となります:
送信の属性
アイテムをカタログに送信する前に、送信するアイテムを説明する JSON ドキュメントを準備する必要があります。
これを支援するために、pac category create-submission コマンドによりサンプル submission.json ファイルが生成されます。
アイテムを提出するには、このファイルを編集する必要があります。 次に例を示します。
{
"modelVersion": "1.0.0.0",
"operation": "CreateOrUpdate",
"sourcePortal": 526430005,
"businessJustification": "Power Platform custom connector for Conference API",
"publisherDetails": {
"publisherId": "ContosoConferencesTeam",
"publisherDisplayName": "Catalog Conferences Team"
},
"catalogItemDefinition": {
"id": "ContosoConferencesCustomConnector",
"displayName": "Contoso Conference Custom Connector",
"description": "Demo Custom connector to query Conference Speakers & Sessions",
"offer": {
"type": "Component_Collection",
"deploymentType": "Normal",
"engineeringName": {
"firstName": "Jennifer",
"lastName": "Wilkins",
"email": "jwilkins@contoso.com",
"phoneNumber": "555-111-1234"
},
"supportName": {
"firstName": "Aidan",
"lastName": "Hunt",
"email": "ahunt@contoso.com",
"phoneNumber": "555-111-1234"
}
}
}
}
提出ファイルの有効なプロパティについて説明します
アイテムをカタログに送信する
カタログに送信されるアイテムは、パッケージ展開パッケージに含める必要があります。 パッケージ展開パッケージには、ソリューション zip ファイルと、パッケージの展開時に適用するオプションの手順が含まれています。 Package Deployer パッケージがない場合は、アイテムを含むソリューション用にパッケージを作成できます。
送信メタデータ JSON ドキュメントが完成したら、pac catalog submit コマンドを使用して送信します。
カタログ提出 JSON ドキュメントを参照するには、必須の --path パラメーターを使用します。
すでに Package Deployer パッケージをお持ちの場合:
- Package Deployer パッケージを参照するには、
--package-zip パラメータを使用します。
- それ以外の場合は、
--solution-zip パラメータを使ってこのソリューションを参照してください。
submit コマンドは、バックグラウンドでパッケージを作成します。
送信要求のステータスのポーリングを組み合わせる場合は、--poll-status パラメータを使ってください。 それ以外の場合は、カタログ送信のステータスを確認するで説明されているように、pac catalog statusコマンドを使ってください。
pac catalog submit -p "BuildDemoSubmission.json" -sz "ContosoConference_1_0_0_1_managed.zip"
Creating package for catalog submit request...
Connected to... TestCatalog
Connected as user@domain
Tracking id for this submission is 0e6b119d-80f3-ed11-8849-000d3a0a2d9d
Microsoft Power Platform CLI とは?
静的 SubmitCatalogApprovalRequest メソッドは、 mspcat_SubmitCatalogApprovalRequest メッセージの使用方法を示します。 この例では、mspcat_SubmitCatalogApprovalRequestRequest コマンドを使用して生成されたmspcat_SubmitCatalogApprovalRequestResponse および クラスを使用します。
このサンプル メソッドは、mspcat_SubmitCatalogApprovalRequestResponse クラスのインスタンスを返します。このクラスには、送信のステータスを確認するために使用できる CertificationRequestId および AsyncOperationId プロパティが含まれています。
mspcat_SubmitCatalogApprovalRequest メッセージでは、送信 JSON ファイルの CatalogItemDefinitionpackageFile プロパティが、Package Deployer パッケージ ファイルをダウンロードするための URL を指定するように設定されている必要があります。
/// <summary>
/// Submits a Catalog item for approval
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance.</param>
/// <param name="pathToSubmissionFile">The location of the submission file</param>
/// <returns>
/// mspcat_SubmitCatalogApprovalRequestResponse contains AsyncOperationId
/// and CertificationRequestId
/// </returns>
static mspcat_SubmitCatalogApprovalRequestResponse SubmitCatalogApprovalRequest(
IOrganizationService service,
FileInfo pathToSubmissionFile)
{
byte[] fileBytes = File.ReadAllBytes(pathToSubmissionFile.FullName);
string encodedSubmissionFile = Convert.ToBase64String(fileBytes);
var request = new mspcat_SubmitCatalogApprovalRequestRequest
{
EncodedApprovalRequest = encodedSubmissionFile
};
return (mspcat_SubmitCatalogApprovalRequestResponse)service.Execute(request);
}
.NET 用 Dataverse SDK を使用する
.NET 用 SDK の事前バインド クラスを生成する
次の例は、SubmitCatalogApprovalRequestPowerShell 関数は mspcat_SubmitCatalogApprovalRequest メッセージを使用する方法を説明します。
返される結果は、mspcat_SubmitCatalogApprovalRequestResponse 複合型のインスタンスを返します。このクラスには、送信のステータスを確認するために使用できる CertificationRequestId および AsyncOperationId プロパティが含まれています。
mspcat_SubmitCatalogApprovalRequest メッセージでは、送信 JSON ファイルの CatalogItemDefinitionpackageFile プロパティが、Package Deployer パッケージ ファイルをダウンロードするための URL を指定するように設定されている必要があります。
この関数は、$baseURIで説明されているように、$baseHeaders 関数を使用して設定された Connect および 値に依存します。
function SubmitCatalogApprovalRequest {
param (
[Parameter(Mandatory)]
[System.IO.FileInfo]
$pathToSubmissionFile
)
$uri = $baseURI + 'mspcat_SubmitCatalogApprovalRequest'
$encodedApprovalRequest = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($pathToSubmissionFile.FullName))
$body = @{
EncodedApprovalRequest = $encodedApprovalRequest
} | ConvertTo-Json
$postHeaders = $baseHeaders.Clone()
$postHeaders.Add('Content-Type', 'application/json')
$results = Invoke-RestMethod `
-Method Post `
-Uri $uri `
-Headers $postHeaders `
-Body $body
return @{
CertificationRequestId = $results.CertificationRequestId
AsyncOperationId = $results.AsyncOperationId
}
}
Microsoft Dataverse Web API を使用する
PowerShell と Visual Studio Code と Dataverse Web API を使用する
管理されていないソリューションから Package Deployer パッケージを作成する
mspcat_SubmitCatalogApprovalRequestで説明されているように、 メッセージを .NET 用 SDK または Web API で使用する場合、送信 JSON ファイルに、Package Deployer パッケージ ファイルをダウンロードするための URL を指定するように で設定された packageFilefilesaslinkプロパティが含まれている必要があります。 自動的に行われるため、pac catalog submit コマンドでこれを行う必要はありません。
この URL は、Dataverse 資格情報なしでファイルをダウンロードできる任意の場所を表すことができますが、パブリックのダウンロード場所にファイルを配置することはお勧めしません。 代わりに、パッケージ送信ストア (mspcat_PackageStore) テーブルを使用して、テナント内の任意の環境から非管理ソリューションを使用して Package Deployer パッケージを生成できます。 このプロセスは、PackageFile (mspcat_PackageFile) ファイル列にパッケージを含むレコードをこのテーブルに生成します。 その後、GetFileSasUrl のメッセージを使って共有アクセス署名 (SAS) URL を取得し、1 時間以内にファイルを匿名でダウンロードできるようにします。 URL は 1 時間以内にのみ有効であるため、ファイルをダウンロードするためのアクセスが期限切れにならないように、このプロセスを自動化する必要があります。
Process
以下の値でパッケージ送信ストア (mspcat_PackageStore) レコードを作成します
| Column |
価値 |
mspcat_name |
アンマネージド ソリューションの名前 |
mspcat_solutionuniquename |
アンマネージド ソリューションの一意の名前 |
mspcat_intendeddeploymenttype |
526430000導入の |
mspcat_operation |
958090001の |
statuscode の値を 958090003 の から 958090004 の に更新します。
この更新により、プロセスが開始されます。
statuscode が 958090001のに変わるまで待ちます。
GetFileSasUrlの URL を取得するには を使用します。 これは、GetFileSasUrlResponse オブジェクトを返します。
CatalogFileAsset JSON オブジェクトを次のプロパティを設定するように作成します。
| Property |
価値 |
name |
GetFileSasUrlResponse.FileName |
filesaslink |
GetFileSasUrlResponse.SasUrl |
これを、JSON 送信ファイルの CatalogItemDefinitionpackageFile プロパティに設定します。
mspcat_SubmitCatalogApprovalRequest を使用して、カタログにアイテムを送信するの説明に従って、送信します
静的 CatalogItemFromSolution 算出方法は、プロセスで説明されている手順に従って、ソリューションからカタログ アイテムを作成する方法を示します。 この関数によってプロパティが追加されるため、この関数の catalogItemSubmissionJsonString パラメーターには packageFile プロパティを設定しないでください。
/// <summary>
/// Processes a solution and returns the catalog item ID
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
/// <param name="solutionName">The name of the solution</param>
/// <param name="solutionUniqueName">The unique name of the solution</param>
/// <param name="catalogItemSubmissionJsonString">The string containing the submission json file</param>
/// <returns>Catalog Item ID</returns>
/// <exception cref="Exception"></exception>
static string CatalogItemFromSolution(
IOrganizationService service,
string solutionName,
string solutionUniqueName,
string catalogItemSubmissionJsonString
)
{
Entity packageStoreRecord = new("mspcat_packagestore")
{
Attributes = {
{"mspcat_name", solutionName},
{"mspcat_solutionuniquename", solutionUniqueName},
{"mspcat_intendeddeploymenttype", new OptionSetValue(526430000)}, // Standard
{"mspcat_operation", new OptionSetValue(958090001)} //Create Package
}
};
Guid packageStoreRecordId = service.Create(packageStoreRecord);
Console.WriteLine($"Created package store record with ID {packageStoreRecordId}");
packageStoreRecord.Attributes.Clear(); //Don't send values again
packageStoreRecord.Id = packageStoreRecordId;
int statusCodeValue = 958090004; // Submitted
string statusReason; // Set in the loop
packageStoreRecord["statuscode"] = new OptionSetValue(statusCodeValue);
service.Update(packageStoreRecord); //Set status to Submitted
Console.WriteLine("Updated package store record status to Submitted");
// Columns to retrieve while polling the package store record
ColumnSet packageStoreColumns = new("statuscode");
do
{
Task.Delay(10000).Wait(); //Wait 10 seconds between polling
// Retrieve the record
packageStoreRecord = service.Retrieve(
"mspcat_packagestore",
packageStoreRecord.Id,
packageStoreColumns);
// Get the status code value
statusCodeValue = packageStoreRecord
.GetAttributeValue<OptionSetValue>("statuscode").Value;
statusReason = packageStoreRecord
.FormattedValues["statuscode"];
Console.WriteLine($" - Package store record status is {statusReason}");
// Continue while statusCodeValue is Submitted, Pending, or Running
} while (statusCodeValue.Equals(958090004) ||
statusCodeValue.Equals(1) ||
statusCodeValue.Equals(958090000));
// If it isn't Completed, throw an exception
if (!statusCodeValue.Equals(958090001))
{
statusReason = packageStoreRecord
.FormattedValues["statuscode"];
// 958090002 is 'Failed'
throw new Exception($"Package submission {statusReason}");
}
Console.WriteLine($"Package submission {statusReason}");
// If successful, retrieve the details about the file to download
GetFileSasUrlRequest getFileSasUrlRequest = new()
{
Target = new EntityReference("mspcat_packagestore", packageStoreRecord.Id),
FileAttributeName = "mspcat_packagefile"
};
var getFileSasUrlResponse = (GetFileSasUrlResponse)service
.Execute(getFileSasUrlRequest);
FileSasUrlResponse getFileSasUrlResponseResult = getFileSasUrlResponse.Result;
Console.WriteLine($"Retrieved SAS URL for {getFileSasUrlResponseResult.FileName}");
// Add the packageFile to the catalog item submission
var catalogItemSubmissionJsonObject = JsonNode.Parse(catalogItemSubmissionJsonString).AsObject();
var packageFile = new JsonObject
{
["name"] = getFileSasUrlResponseResult.FileName,
["filesaslink"] = getFileSasUrlResponseResult.SasUrl
};
// Add the packageFile to the catalog item submission
catalogItemSubmissionJsonObject["catalogItemDefinition"]["packageFile"] = packageFile;
catalogItemSubmissionJsonString = catalogItemSubmissionJsonObject.ToJsonString();
string encodedSubmissionJson = Convert
.ToBase64String(Encoding.UTF8.GetBytes(catalogItemSubmissionJsonString));
var submitCatalogApprovalRequest = new mspcat_SubmitCatalogApprovalRequestRequest
{
EncodedApprovalRequest = encodedSubmissionJson
};
var submitCatalogApprovalResponse = (mspcat_SubmitCatalogApprovalRequestResponse)service
.Execute(submitCatalogApprovalRequest);
Guid certificationRequestId = submitCatalogApprovalResponse.CertificationRequestId;
Console.WriteLine($"Submitted catalog approval request with ID {certificationRequestId}");
// Approval must be in either InProgress or Submitted to be processed
// Columns to retrieve while polling the certification request record
ColumnSet certificationRequestColumns = new("statuscode", "mspcat_application");
Entity certificationRequestRecord;
do
{
Task.Delay(10000).Wait(); //Wait 10 seconds between polling
// Retrieve the record
certificationRequestRecord = service.Retrieve(
"mspcat_certificationrequest",
certificationRequestId,
certificationRequestColumns);
// Get the status code value
statusCodeValue = certificationRequestRecord
.GetAttributeValue<OptionSetValue>("statuscode").Value;
statusReason = packageStoreRecord
.FormattedValues["statuscode"];
Console.WriteLine($" - Approval Request status is {statusReason}");
// Continue while statusCodeValue is:
} while (statusCodeValue.Equals(526430002) || // Waiting On Submitter,
statusCodeValue.Equals(526430003) || // Pending Deployment,
statusCodeValue.Equals(526430008) || // Draft
statusCodeValue.Equals(526430009)); // Processing
// If it isn't Submitted or InProgress, throw an exception
if (!(statusCodeValue.Equals(1) || statusCodeValue.Equals(526430001)))
{
string statusreason = certificationRequestRecord
.FormattedValues["statuscode"];
throw new Exception($"Certification request {statusreason}");
}
// Approve the request
mspcat_ResolveApprovalRequest resolveApprovalRequest = new()
{
Target = new EntityReference("mspcat_certificationrequest", certificationRequestId),
requestsuccess = true, //Approve the request
message = "Approved by CatalogItemFromSolution function"
};
// mspcat_ResolveApprovalResponse has no properties to return
service.Execute(resolveApprovalRequest);
Console.WriteLine("Approved the certification request");
// Get the Catalog Item
EntityReference catalogItemReference = certificationRequestRecord
.GetAttributeValue<EntityReference>("mspcat_application");
Entity catalogItem = service.Retrieve(
"mspcat_applications",
catalogItemReference.Id,
new ColumnSet("mspcat_tpsid"));
string tpsid = catalogItem.GetAttributeValue<string>("mspcat_tpsid");
Console.WriteLine($"Returning Catalog Item ID: {tpsid}");
return tpsid;
}
Output
この関数の出力は次のようになります。
Created package store record with ID 46f662aa-2137-ef11-8409-6045bdd3aec3
Updated package store record status to Submitted
- Package store record status is Submitted
- Package store record status is Pending
- Package store record status is Running
- Package store record status is Running
- Package store record status is Completed
Package submission Completed
Retrieved SAS URL for <solutionName>_1_0_0_0.zip
Submitted catalog approval request with ID b932c7c8-2137-ef11-8409-6045bdd3aec3
- Approval Request status is Completed
Approved the certification request
Returning Catalog Item ID: <solutionUniqueName>
この New-CatalogItemFromSolution PowerShell 関数は、プロセスで説明されている手順に従って、ソリューションからカタログ アイテムを作成する方法を示します。 この関数によってプロパティが追加されるため、この関数の catalogItemSubmissionJsonString パラメーターには packageFile プロパティを設定しないでください。
この New-CatalogItemFromSolution PowerShell 関数は、以下の変数と関数に依存します:
-
$baseURIで説明されているように、$baseHeaders 関数を使用して設定された Connect および 値
-
New-Recordで説明されている Update-Record、Get-Record および 関数
-
Get-FileSasUrlで説明された 関数
.SYNOPSIS
Creates a new catalog item from a solution and submits it for approval.
.DESCRIPTION
The `New-CatalogItemFromSolution` function automates the process of creating a new catalog item from a specified solution and submitting it for approval. It performs the following steps:
1. Validates the existence of the solution.
2. Creates a package store record.
3. Submits the package for approval.
4. Monitors the approval status.
5. Retrieves the SAS URL for the package file.
6. Submits the catalog item for certification.
.PARAMETER solutionName
The name of the solution.
.PARAMETER solutionUniqueName
The unique name of the solution.
.PARAMETER catalogItemSubmissionJsonString
The JSON string containing the catalog item submission details.
.EXAMPLE
New-CatalogItemFromSolution `
-solutionName "MySolution" `
-solutionUniqueName "my_solution" `
-catalogItemSubmissionJsonString '{"catalogItemDefinition":{...}}'
This example creates a new catalog item from the solution named "MySolution" with the unique name "my_solution" and submits it for approval using the provided JSON string.
.NOTES
Ensure that the `Get-Records`, `New-Record`, `Update-Record`, `Get-Record`, and `Get-FileSasUrl` functions are defined and accessible in your environment.
The function uses specific status codes and operations that should be defined in your system.
function New-CatalogItemFromSolution {
param(
[Parameter(Mandatory)]
[string]
$solutionName,
[Parameter(Mandatory)]
[string]
$solutionUniqueName,
[Parameter(Mandatory)]
[string]
$catalogItemSubmissionJsonString
)
$statusCodeLabelName = 'statuscode@OData.Community.Display.V1.FormattedValue'
$solutionQuery = "?`$filter=uniquename eq '$solutionUniqueName'&`$select=solutionid"
$solutionCollection = (Get-Records `
-setName 'solutions' `
-query $solutionQuery).value
if (!$solutionCollection.Count -eq 1) {
throw "Solution with unique name $solutionUniqueName does not exist"
}
$packageStoreRecord = @{
mspcat_name = $solutionName
mspcat_solutionuniquename = $solutionUniqueName
mspcat_intendeddeploymenttype = 526430000 # Standard
mspcat_operation = 958090001 # Create Package
}
$packageId = New-Record `
-setName 'mspcat_packagestores' `
-body $packageStoreRecord
Write-Host ('Created package store record with ID ' + $packageId)
# Set statuscode to Submitted
$packageStoreRecord = @{
statuscode = 958090004
}
Update-Record `
-setName 'mspcat_packagestores' `
-id $packageId `
-body $packageStoreRecord | Out-Null
Write-Host 'Updated package store record status to Submitted'
do {
Start-Sleep -Seconds 10
$packageStore = Get-Record `
-setName 'mspcat_packagestores' `
-id $packageId `
-query '?$select=statuscode,mspcat_processingmessage'
$statusCodeValue = $packageStore.statuscode
$statusCodeLabel = $packageStore.$statusCodeLabelName
Write-Host (' - Package store record status is ' + $statusCodeLabel)
} while ($statusCodeValue -eq 958090004 -or # Submitted
$statusCodeValue -eq 1 -or # Pending
$statusCodeValue -eq 958090000) # Running
if ($statusCodeValue -ne 958090001) {
# 958090002 is 'Failed'
throw "Package submission $statusCodeLabel"
}
# If successful, retrieve the details about the file to download
$fileSasUrlResponse = Get-FileSasUrl `
-setName 'mspcat_packagestores' `
-id $packageId `
-columnName 'mspcat_packagefile'
Write-Host ('Retrieved SAS URL for ' + $fileSasUrlResponse.FileName)
$catalogItemSubmission = $catalogItemSubmissionJsonString | ConvertFrom-Json
$packageFile = @{
name = $fileSasUrlResponse.FileName
filesaslink = $fileSasUrlResponse.SasUrl
}
$catalogItemSubmission.catalogItemDefinition.packageFile = $packageFile
$catalogItemSubmissionJsonString = $catalogItemSubmission | ConvertTo-Json -Depth 10
$encodedCatalogItemSubmission = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($catalogItemSubmissionJsonString))
$body = @{
EncodedApprovalRequest = $encodedCatalogItemSubmission
} | ConvertTo-Json
$postHeaders = $baseHeaders.Clone()
$postHeaders.Add('Content-Type', 'application/json')
$results = Invoke-RestMethod `
-Method Post `
-Uri ($baseURI + 'mspcat_SubmitCatalogApprovalRequest') `
-Headers $postHeaders `
-Body $body
$certificationRequestId = $results.CertificationRequestId
Write-Host ('Submitted catalog approval request with ID ' + $certificationRequestId)
# Approval must be in either InProgress or Submitted to be processed
do {
Start-Sleep -Seconds 10
# Retrieve the record
$approvalRequestRecord = Get-Record `
-setName 'mspcat_certificationrequests' `
-id $certificationRequestId `
-query '?$select=statuscode'
# Get the status code value
$statusCodeValue = $approvalRequestRecord.statuscode
$statusCodeLabel = $approvalRequestRecord.$statusCodeLabelName
Write-Host (' - Approval request status is ' + $statusCodeLabel)
} while ($statusCodeValue -eq 526430002 -or # Waiting On Submitter
$statusCodeValue -eq 526430003 -or # Pending Deployment
$statusCodeValue -eq 526430008 -or # Draft
$statusCodeValue -eq 526430009) # Processing
# If statuscode isn't Submitted or InProgress, throw an exception
if (!($statusCodeValue -eq 1 -or $statusCodeValue -eq 526430001)) {
throw "Certification request $statusCodeLabel"
}
# Approve the request
ResolveApproval `
-certificationRequestId $certificationRequestId `
-requestsuccess $true `
-message 'Approved by script'
Write-Host 'Approved the certification request'
# Get the Catalog Item
$query = '?$select=mspcat_certificationrequestid'
$query += '&$expand=mspcat_Application($select=mspcat_tpsid)'
$approvalRequestRecord = Get-Record `
-setName 'mspcat_certificationrequests' `
-id $certificationRequestId `
-query $query
$tpsid = $approvalRequestRecord.mspcat_Application.mspcat_tpsid
Write-Host ('Returning Catalog Item ID:' + $tpsid)
return $tpsid
}
Output
この関数の出力は次のようになります。
Created package store record with ID 46f662aa-2137-ef11-8409-6045bdd3aec3
Updated package store record status to Submitted
- Package store record status is Submitted
- Package store record status is Pending
- Package store record status is Running
- Package store record status is Running
- Package store record status is Completed
Package submission Completed
Retrieved SAS URL for <solutionName>_1_0_0_0.zip
Submitted catalog approval request with ID b932c7c8-2137-ef11-8409-6045bdd3aec3
- Approval Request status is Completed
Approved the certification request
Returning Catalog Item ID: <solutionUniqueName>
カタログの送信状況を確認する
承認要求 (mspcat_certificationrequest) テーブルの statuscode Choices/Options オプション。 完了 (2) は、送信が成功したことを表します。
| 価値 |
ラべル |
| 6 |
提出済み |
| 526430001 |
InProgress |
| 526430002 |
送信者を待機しています |
| 526430003 |
展開を保留しています |
| 526430008 |
下書きです |
| 526430009 |
処理中 |
| 2 |
Completed |
| 526430000 |
破棄済み |
| 526430004 |
Rejected |
| 526430005 |
マーケティング コンテンツ |
| 526430006 |
重複した要求 |
| 526430010 |
失敗した事前検証 |
pac category status コマンドを使用して、カタログ送信のステータスを確認します。
pac catalog status --tracking-id 0e6b119d-80f3-ed11-8849-000d3a0a2d9d --type submit
Connected to... TestCatalog
Connected as user@domain
Status of the Submit request: Submitted
Microsoft Power Platform CLI とは?
次の静的 GetApprovalRequest 算出方法では、承認リクエスト (mspcat_certificationrequest) テーブル から、trackingId パラメーターがレコードの主キーと一致するアイテムの選択された列を取得します。
/// <summary>
/// Retrieves an Approval Request with selected columns
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance.</param>
/// <param name="trackingId">The ID of the approval request</param>
/// <returns>The approval request record</returns>
static Entity GetApprovalRequest(IOrganizationService service, Guid trackingId)
{
ColumnSet columns = new("createdby",
"createdon",
"modifiedby",
"modifiedon",
"mspcat_autoapproved",
"mspcat_certstartdate",
"mspcat_codereview",
"mspcat_dropcontainsmultiplepackages",
"mspcat_functionalvalidation",
"mspcat_internalreview",
"mspcat_isvduration",
"mspcat_marketingonlychange",
"mspcat_packagedeployment",
"mspcat_publisher",
"mspcat_requestname",
"mspcat_requestsource",
"mspcat_requestsaccesstotspevents",
"mspcat_requestssecurestoreaccess",
"mspcat_stagename",
"mspcat_totalduration",
"ownerid",
"statecode",
"statuscode");
return service.Retrieve("mspcat_certificationrequest", trackingId, columns);
}
.NET 用 Dataverse SDK を使用する
次の Get-ApprovalRequest PowerShell 関数は、承認要求 (mspcat_certificationrequest) テーブルから、$trackingId パラメーターがレコードの主キーと一致する品目について、選択した列を取得します。
この関数は、Get-Recordで説明した 関数に依存します。
function Get-ApprovalRequest{
param(
[Parameter(Mandatory)]
[guid]
$trackingId
)
$columns = @(
'_createdby_value',
'_modifiedby_value',
'_mspcat_publisher_value',
'_ownerid_value',
'createdon',
'modifiedon',
'mspcat_autoapproved',
'mspcat_certstartdate',
'mspcat_codereview',
'mspcat_dropcontainsmultiplepackages',
'mspcat_functionalvalidation',
'mspcat_internalreview ',
'mspcat_isvduration',
'mspcat_marketingonlychange',
'mspcat_packagedeployment',
'mspcat_requestname',
'mspcat_requestsource',
'mspcat_requestsaccesstotspevents',
'mspcat_requestssecurestoreaccess',
'mspcat_stagename',
'mspcat_totalduration',
'statecode',
'statuscode'
)
$selectcolumns = '?$select=' + ($columns -join ',')
return Get-Record `
-setName 'mspcat_certificationrequests' `
-id $trackingId `
-query $selectcolumns
}
Microsoft Dataverse Web API を使用する
PowerShell と Visual Studio Code と Dataverse Web API を使用する
カタログの提出を承認する
カタログの送信は通常、Power Platform カタログ マネージャー アプリケーション内で承認されます。
この操作を実行するための PAC CLI コマンドはありません。
この静的 ResolveApproval 算出方法は、 mspcat_ResolveApproval メッセージを使用してカタログ送信の要求を解決する方法を示しています。 この例では、mspcat_ResolveApprovalRequest コマンドを使用して生成された クラスを使用します。
/// <summary>
/// Resolves a catalog submission approval
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance.</param>
/// <param name="certificationRequestId">The ID of the certification request.</param>
/// <param name="requestsuccess">The decision to approve or reject the request.</param>
/// <param name="message">Information for the submitter about the resolution</param>
static void ResolveApproval(
IOrganizationService service,
Guid certificationRequestId,
bool requestsuccess,
string message)
{
mspcat_ResolveApprovalRequest request = new()
{
Target = new EntityReference("mspcat_certificationrequest", certificationRequestId),
requestsuccess = requestsuccess,
message = message
};
// mspcat_ResolveApprovalResponse has no properties to return
service.Execute(request);
}
この ResolveApproval PowerShell 関数は、 mspcat_ResolveApproval アクションを使用してカタログ送信の要求を解決する方法を示しています。
この関数は、$baseURIで説明されているように、$baseHeaders 関数を使用して設定された Connect および 値に依存します
<#
.SYNOPSIS
This function resolves an approval request.
.DESCRIPTION
mspcat_ResolveApproval is an action bound to the mspcat_certificationrequests table.
.PARAMETER certificationRequestId
This is a mandatory GUID parameter that represents the ID of the certification request.
.PARAMETER requestsuccess
This is a mandatory Boolean parameter that indicates the decision to approve or reject the request..
.PARAMETER message
This is a mandatory string parameter that contains information for the submitter about the resolution.
.EXAMPLE
ResolveApproval `
-certificationRequestId "<Guid>" `
-requestsuccess $true `
-message "Request processed successfully."
.NOTES
The function does not return any value.
Any output from the Invoke-RestMethod cmdlet is sent to Out-Null.
#>
function ResolveApproval {
param (
[Parameter(Mandatory)]
[guid]
$certificationRequestId,
[Parameter(Mandatory)]
[bool]
$requestsuccess,
[Parameter(Mandatory)]
[string]
$message
)
$uri = $baseURI + "mspcat_certificationrequests($certificationRequestId)"
$uri += "/Microsoft.Dynamics.CRM.mspcat_ResolveApproval"
$body = @{
requestsuccess = $requestsuccess
message = $message
} | ConvertTo-Json
$postHeaders = $baseHeaders.Clone()
$postHeaders.Add('Content-Type', 'application/json')
Invoke-RestMethod `
-Method Post `
-Uri $uri `
-Headers $postHeaders `
-Body $body | Out-Null
}
Microsoft Dataverse Web API を使用する
PowerShell と Visual Studio Code と Dataverse Web API を使用する
次の手順