Peristiwa
Kejohanan Dunia Power BI DataViz
14 Feb, 4 PTG - 31 Mac, 4 PTG
Dengan 4 peluang untuk menyertai, anda boleh memenangi pakej persidangan dan berjaya ke Grand Finale LIVE di Las Vegas
Ketahui lebih lanjutPelayar ini tidak lagi disokong.
Naik taraf kepada Microsoft Edge untuk memanfaatkan ciri, kemas kini keselamatan dan sokongan teknikal yang terkini.
The Microsoft Dataverse SDK for .NET allows you to detect duplicate rows to maintain integrity of data. For detailed information about detecting duplicate data using code, see Detect duplicate data using code.
Nota
Make sure there are appropriate duplicate detection rules in place. Dataverse includes default duplicate detection rules for accounts, contacts, and leads, but not for other types of rows. If you want the system to detect duplicates for other row types, you’ll need to create a new rule.
- For information on how to create a duplicate detection rule using the UI, see Set up duplicate detection rules to keep your data clean.
- For information on creating duplicate detection rules using code, see Duplicate rule tables
You can programmatically check whether a table row is a duplicate or will be a duplicate before creating or updating it by using the RetrieveDuplicatesRequest class.
var account = new Account();
account.Name = "Sample Account";
var request = new RetrieveDuplicatesRequest()
{
BusinessEntity = account,
MatchingEntityName = account.LogicalName,
PagingInfo = new PagingInfo() { PageNumber = 1, Count = 50 }
};
var response = (RetrieveDuplicatesResponse)svc.Execute(request);
if (response.DuplicateCollection.Entities.Count >= 1)
{
Console.WriteLine("{0} Duplicate rows found.", response.DuplicateCollection.Entities.Count);
}
If you want to have the platform throw an error when a new row you create is determined to be a duplicate row, or you update an existing row so that duplicate detection rules will be evaluated, you must use the CreateRequest or UpdateRequest classes with the IOrganizationService.Execute method and apply the SuppressDuplicateDetection
parameter set to false
.
The following code will throw an InvalidOperationException
exception with the message A record was not created or updated because a duplicate of the current record already exists.
when the following are true:
Sample Account
var account = new Account();
account.Name = "Sample Account";
var request = new CreateRequest();
request.Target = account;
request.Parameters.Add("SuppressDuplicateDetection", false);
try
{
svc.Execute(request);
}
catch (FaultException<OrganizationServiceFault> ex)
{
switch (ex.Detail.ErrorCode)
{
case -2147220685:
throw new InvalidOperationException(ex.Detail.Message);
default:
throw ex;
}
}
Peristiwa
Kejohanan Dunia Power BI DataViz
14 Feb, 4 PTG - 31 Mac, 4 PTG
Dengan 4 peluang untuk menyertai, anda boleh memenangi pakej persidangan dan berjaya ke Grand Finale LIVE di Las Vegas
Ketahui lebih lanjutLatihan
Laluan pembelajaran
Create relationships, business rules, calculations, and rollups in Microsoft Dataverse - Training
Do you need to create data relationships, business rules, calculations, and rollups in Dataverse? These modules help you use Dataverse to build powerful business solutions to transform your operations, processes, and your entire organization. The learning path Get started with Dataverse introduces you to Dataverse and many of the key concepts which include environment, entities, fields, and options sets. This learning path continues and expands the exploration of Dataverse with an overview how to form rela
Dokumentasi
Update and delete table rows using the SDK for .NET (Microsoft Dataverse) - Power Apps
Learn how to update and delete table rows using the SDK for .NET.
Associate and disassociate table rows using the SDK for .NET (Microsoft Dataverse) - Power Apps
Learn how to associate and disassociate table rows using the SDK for .NET
Detect duplicate data using the Web API (Microsoft Dataverse) - Power Apps
Read how to detect duplicates using MSCRM.SuppressDuplicateDetection header and Microsoft Dataverse Web API
Retrieve specific columns for an entity via query APIs - Power Apps
Queries submitted to retrieve data should include specific columns in the ColumnSet instance associated to the query rather than All Columns.