c# - How do i create a metadataId for a custom class derived from OrganizationRequest? -
i have created custom retrieve entity response class crm2011 serialize class. entity response class derived organizationrequest class. shown below:
public partial class retrieveentityrequest : organizationrequest { public retrieveentityrequest() { } private system.guid metadataidfield; public system.guid metadataid { { return this.metadataidfield; } set { this.metadataidfield = value; } } public entityfilters entityfilters { get; set; } public string logicalname { get; set; } public bool retrieveasifpublished { get; set; } }
now when run code shown below
using (organizationserviceproxy serviceproxy = new organizationserviceproxy(organizationuri, homerealmuri, credentials, null)) { try { serviceproxy.enableproxytypes(); request = new crmutilities.retrieveentityrequest(); request.logicalname=entityname; request.entityfilters = entityfilters.entity; request.requestname = requestname; //execute request retrieveentityresponse = (crmutilities.retrieveentityresponse)serviceproxy.execute(request); } catch (system.web.services.protocols.soapexception ex) { throw ex; } catch (exception ex) { throw ex; } }
it says metadataid required field missing.the exception thrown organizationservicefault caught //required field 'metadataid' missing. how create metadataid custom object in case?
check out msdn documentation organizationrequest
. 1 of properties parameters
, collection of data needed request work.
your getter , setter should set (or retrieve) value collection. can't create private field , expect work. ;)
for record - other request classes available in crm sdk follow same pattern - derive organizationrequest
, properties shortcuts manipulate required parameters
.
Comments
Post a Comment