MS Dynamics 2011 Online に接続しようとしています。コードの xrm の使用部分で、次のエラーが表示されます。
値 'Xrm.XrmServiceContext, Xrm' は有効な型として認識されないか、型 'Microsoft.Xrm.Sdk.Client.OrganizationServiceContext' ではありません。
これが私のコードです:
var contextName = "Xrm";
using (var xrm = CrmConfigurationManager.CreateContext(contextName) as XrmServiceContext)
{
WriteExampleContacts(xrm);
//Create a new contact called Allison Brown.
var allisonBrown = new Xrm.Contact
{
FirstName = "Allison",
LastName = "Brown",
Address1_Line1 = "23 Market St.",
Address1_City = "Sammamish",
Address1_StateOrProvince = "MT",
Address1_PostalCode = "99999",
Telephone1 = "12345678",
EMailAddress1 = "allison.brown@example.com"
};
xrm.AddObject(allisonBrown);
xrm.SaveChanges();
WriteExampleContacts(xrm);
}
App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="microsoft.xrm.client" type="Microsoft.Xrm.Client.Configuration.CrmSection, Microsoft.Xrm.Client"/>
</configSections>
<connectionStrings>
<add name="Xrm"
connectionString="Url=https://MYORG.crm.dynamics.com/XRMServices"/>
</connectionStrings>
<microsoft.xrm.client>
<contexts>
<add name="Xrm" type="Xrm.XrmServiceContext, Xrm"/>
</contexts>
</microsoft.xrm.client>
</configuration>
Xrm.XrmServiceContext は、私の実際の XrmServiceContext 名です。コンソール アプリケーションの Xrm.cs ファイルに保持されます。