Can I access CRM MetadataService through UII Classes?

Feb 29, 2012 at 9:45 AM
Edited Feb 29, 2012 at 9:46 AM

I don't know if what I want to do is possible but this is my problem. I have a request from a customer to be able to search by CRM fields that are picklists in CRM. I created combo boxes and I'm setting the values manually for the time being but I'd prefer to read them using the MetadataService so that if their values change in CRM I don't have to change CCA Coding.

So the question is is there any way to access the metadata service like for example we are doing with CrmService through AifServiceBase?

I looked at Microsoft.Uii.AifServices dll but couldn't find it. Maybe I was looking at the wrong place though.

Any help would be appreciated.

Thanks in advance.

 

P.S. I'm using CCA for CRM 4.0, not R2.

Feb 29, 2012 at 3:20 PM
Edited Feb 29, 2012 at 3:20 PM

As part of the connection process, there is code that looks like this:
AuthenticationService authSvc = AifServiceContainer.Instance.GetService<AuthenticationService>();

Then a line authSvc.Connect( ….. )

One of the forms of Connect takes the ServerURL and MetadataServiceURL.   After you have used that form of the constructor, you can call authSvc.MetadataService to get the metadata services.

Also, if you use the ConnectUsingDiscovery method call on the authSvc, it will automatically configure both the organization service and the metadata services for you.

Mattb-msft

Mar 1, 2012 at 10:51 AM

Many thanks Matt, it works like a charm.

Helpful as always.