Sample: Work with activity party records
This sample code shows how to work with activity party records. Learn how to create a letter activity addressed to multiple contacts.
Related article: Activity tables
About the sample code
Sample | Description | Build target |
---|---|---|
ActivityParty | Demonstrates creating a letter activity. | .NET 9 |
The code sample demonstrates how to create a letter activity. Specifically, the samples demonstrate how to:
- Connect to Dataverse using a connection string that defines required connection information
- Create a letter activity to send to multiple contacts
- Use the Dataverse organization service context to process the data changes
- Use early-bound entity types
The code being demonstrated can be found in the Program.CreateLetter()
method invoked by Program.Run()
.
The early-bound entity files in the DataModel project were generated using the following PAC CLI command:
pac modelbuilder build
. More information: pac modelbuilder
More general information can be found in README-code-design file.
How to build and run the code sample
- Clone the PowerApps-Samples repository.
- Locate the sample folder.
- Open the solution file (*.sln) in Visual Studio.
- Edit the project's appsettings.json file and set the
Url
value as appropriate for your Dataverse test environment. - Build and run the project [F5].
- You are prompted in a browser window for account sign-in credentials to the target environment.
Expected program output
For a successful run, the program's console output should look similar to the following example. Otherwise, any errors or exceptions are displayed.
CreateLetter(): letter activity created with ID < >
Press any key to undo environment data changes.