silverlight - Getting the label of an OptionSetValue through SOAP Service in CRM 2011 -
i have silverlight application needs label of optionsetvalue attribute activity entity. attribute logical name activitytypecode, , have following extension method retrieve attribute metadata:
public static void retrieveattribute(this iorganizationservice service, string entitylogicalname, string entityattributename, action<organizationresponse> callback) { var retrieveattributerequest = new organizationrequest() { requestname = "retrieveattribute", }; retrieveattributerequest["entitylogicalname"] = entitylogicalname; retrieveattributerequest["retrieveasifpublished "] = false; retrieveattributerequest["logicalname"] = entityattributename; service.beginexecute(retrieveattributerequest, result => { if (result.iscompleted) { var response = service.endexecute(result); callback(response); } }, null); }
and use follows on soapctx has been initialized:
soapctx.retrieveattribute("activitypointer", "activitytypecode", orgresponse => { if (orgresponse != null) { // examine orgresponse } });
i able debug procedure fails on line var response = service.endexecute(result); in extension method. following exception message:
the remote server returned error: notfound.
here's stacktrace if find useful:
{system.servicemodel.communicationexception: remote server returned error: notfound. ---> system.net.webexception: remote server returned error: notfound. ---> system.net.webexception: remote server returned error: notfound. @ system.net.browser.browserhttpwebrequest.internalendgetresponse(iasyncresult asyncresult) @ system.net.browser.browserhttpwebrequest.<>c__displayclass5.<endgetresponse>b__4(object sendstate) @ system.net.browser.asynchelper.<>c__displayclass4.<beginonui>b__1(object sendstate)
i appreciate or guidance, thanks!
aside anonymous method following worked me. please note metadataid
private void startgetattributemetadata() { organizationrequest request = new organizationrequest() { requestname = "retrieveattribute" }; request["entitylogicalname"] = "activitypointer"; request["logicalname"] = "activitytypecode"; request["metadataid"] = guid.empty; request["retrieveasifpublished"] = true; iorganizationservice service = soapserverutility.getsoapservice(); service.beginexecute(request, new asynccallback(endgetattributemetadata), service); } private void endgetattributemetadata(iasyncresult result) { organizationresponse response = ((iorganizationservice)result.asyncstate).endexecute(result); }
Comments
Post a Comment