Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is the code i am using to retrieve the CRM OptionSet values of an attribute in the contact entity. The issue i have is that i cannot use the CRM SDK. We will be deploying the project in SSIS and we do not have access to the GAC to install the SDK. I am recieving the following error on the service execution.

ASM
{"Error in line 1 position 732. Element 'http://schemas.datacontract.org/2004/07/System.Collections.Generic:value'
contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/2011/Metadata:PicklistAttributeMetadata'.
The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type
corresponding to 'PicklistAttributeMetadata' to the list of known types - for example, by using the KnownTypeAttribute attribute
or by adding it to the list of known types passed to DataContractSerializer."}


Here is the code snippet

C#
OrganizationRequest request = new OrganizationRequest();
            request.RequestName = "RetrieveAttribute";
            request.Parameters = new ParameterCollection();

            request.Parameters.Add(new KeyValuePair<string, object>("EntityLogicalName", entityLogicalName));
            request.Parameters.Add(new KeyValuePair<string, object>("LogicalName", field));
            request.Parameters.Add(new KeyValuePair<string, object>("RetrieveAsIfPublished", true));
            request.Parameters.Add(new KeyValuePair<string, object>("MetadataId", Guid.Empty));

            OrganizationResponse response = (OrganizationResponse)service.Execute(request);


The error occurrs on the last line when the response is trying to serialize from the service.
Posted
Updated 9-Jun-15 6:30am
v2

1 solution

Hi,
Without using CRM SDK there is one more option we have that "Nuget Package Manager(NPM)"
First you need to download and Install that NPM.
Then open VS and click new project then you have Dynamic CRM option.
Then select Dynamic CRM package.After that it asks your CRM domain details.
After filling all credential and URL details, you have all entities of your current solution.
Right click on your respective entity and select create plugin option.
It generates default plugin code.Write your own logic and deploy the plugin.
After this process,Plugin Automatically register on respective entity.
Here I copy the link for download NPM

https://visualstudiogallery.msdn.microsoft.com/c1eff934-bf97-40a6-bbe3-c25178f18f86[^]

Hope this helps you.
Thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900