I know this question is very basic, but I have been researching for a week and I have not found the solution. In my work I have been asked to find a way to connect to the data and solutions of PowerApps (Dataverse) from PowerShell or Visual Studio.
I've been doing my research and I am able to connect and get data, but I still haven't been able to create a custom entity (table). I have followed this tutorial Create entities using the Organization Service and this is the code I have:
static void Main(string[] args)
{
string url = "xxxxxxxx";
string userName = "xxxxxxxx";
string password = "xxxxxxxx";
string conn = $@"
AuthType = OAuth;
UserName = {userName};
Password = {password};
Url = {url};
AppId = 51f81489-12ee-4a9e-aaae-a2591f45987d;
RedirectUri = app://58145B91-0C36-4500-8554-080854F2AC97;
LoginPrompt = Auto;
RequireNewInstance = True";
var svc = new CrmServiceClient(conn);
using (svc)
{
Entity entitytest = new Entity("test");
var vid = svc.Create(entitytest);
Guid accountid = vid;
}
}
It connects correctly (I censored the personal data), but when executing it I get this error in this line "var vid = svc.Create(entitytest);"
:
System.ServiceModel.FaultException: The entity with a name = 'entitytest' with namemapping = 'Logical' was not found in the MetadataCache. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=1084883, MinActiveRowVersion=1084883, MetadataInstanceId=34390963, LastUpdated=2021-05-30 11:49:56.803
What am I doing wrong? Do you know sites with complete examples?