Hello all. I've begun my journey into writing windows apps to work with our on-prem ifd deployment. We have some orgs on v8.2 and v9. Currently I have a test app that uses the method below retrieve the full name of all records in the contact entity. For now, I'm just interested in exporting the records to an xml file. There will be no record creation, deletion, or updating. I see my results but I have to wonder, is this the correct approach? With the new 'Developer Guide' release, what is deprecated, what isn't deprecated, how do I know which method to use? What are the differences between OrganizationWebProxyClient, OrganizationService, and OrganizationServiceContext? Should I use LINQ, QueryExpression, CreateQuery, FetchXml? So many questions, any help is appreciated.
My test method:
public static void MakeCrmConnection()
{
List<MyEF6DbSet> lstAllOrgs = new List<MyEF6DbSet>();
lstAllOrgs = GetAllOrgs();
if (lstAllOrgs.Count > 0)
{
foreach (var MyEF6DbSet in lstAllOrgs)
{
Console.WriteLine($"Connecting to {MyEF6DbSet.OrganizationName}" + Environment.NewLine);
try
{
CrmServiceClient conn = new CrmServiceClient(getConnString(MyEF6DbSet));
IOrganizationService _orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient
: (IOrganizationService)conn.OrganizationServiceProxy;
OrganizationServiceContext orgSvcContext = new OrganizationServiceContext(_orgService);
if (conn != null && conn.IsReady)
{
Console.WriteLine($"YAY!!! Connected to {MyEF6DbSet.OrganizationName}" + Environment.NewLine);
var query_join = from i in orgSvcContext.CreateQuery("incident")
join c in orgSvcContext.CreateQuery("contact")
on i["customerid"] equals c["contactid"]
select new
{
contact_name = c["fullname"]
};
foreach (var c in query_join)
{
Console.WriteLine($"Full name is {c.contact_name}");
}
}
else
{
Console.WriteLine($"NOT Connected to {MyEF6DbSet.OrganizationName}" + Environment.NewLine);
}
}
catch (Exception)
{
throw;
}
}
}
else
{
Console.WriteLine("There are no organizations to connect to. Bye.");
}
}
*This post is locked for comments
I have the same question (0)