4
votes

I have serious problem with creating a connection to dynamics CRM online from my Window 8 metro style application.

My code works fine under normal (full) .net framework, but fails under WinRT

private IOrganizationService OrgService { get; set; }
private ClientCredentials ClientCreds { get; set; }
private ClientCredentials DeviceCreds { get; set; }
//(..)
ClientCreds = new ClientCredentials();
ClientCreds.UserName.UserName = "[email protected]";
ClientCreds.UserName.Password = "sample_password";

DeviceCreds = DeviceIdManager.LoadOrRegisterDevice();

Uri orgServiceUri = new Uri("https://sampleaddress.api.crm4.dynamics.com/XRMServices/2011/Organization.svc");

OrgService = new OrganizationServiceProxy(orgServiceUri, null, ClientCreds, DeviceCreds);

The last line of this code gives an exception:

The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

Probably this class tries to save some file somewhere, which is not permitted in metro style apps.

Anybody can help with that ? How to bypass this behavior or OrganizationServiceProxy class ?

1

1 Answers

1
votes

Since this is using services, you may be running into a problem I had: having to control the output of generated classes that come back over the wire. The code has to be JITed somewhere and that is often the temp directory.

See my question for controlling the output directory.