7 responses to “CRM 2011 + Retrieve Metadata in Silverlight Web Resource using Organization Service.

  1. nice! iwanted this info.
    and tell me about namespace for this code.
    System.ServerModel and and … Microsoft.Xrm.Sdk ????

    • Thats the sad part….silverlight does not take in System.ServiceModel version 4.0. If you try adding System.ServiceModel it accepts only version 2.0.
      Silverlight is also not compatible with Microsoft.Xrm.Sdk since these assemblies are not built against the silverlight runtime.

      So the only option remains is hard code your parameters as strings as shown in my post.

      thanks for asking question yukitaka!!!

  2. OK, throw out the past. get in the future…
    latest SDK walkthrough was a good cooking space for me.
    “Use the SOAP Endpoint for Web Resources with Silverlight” was my study place in this week.

    in this sample code you can get optionset’s value and label with only adding attribute name. like this…

    Columns = new System.Collections.ObjectModel.ObservableCollection(new string[] { “name”, “address1_addresstypecode” })

    “name” is original one, “address1_addresstypecode” is optionset type attribute.
    then you will see the label text just i checked by fiddler xml display.

    and i found the label text not in attributevalues but in formattedvalues.
    then code like…

    entity.FormattedValues[0].Value // not using GetAttributeValue

    you find [0] ? it’s array, if you chose more optionset, you should check what text is.
    entity.FormattedValues[0].Key // use this.

    value was little complicated.
    OptionSetValue myValue = entity.GetAttributeValue(“address1_addresstypecode”)
    myValue.Value // this is optionset value

    this sample solution has class file then no hard code need.
    maybe usefull crmsvcutil.exe in \sdk\bin directory make class file for you.

    again you don’t need hard code.

    conclusion

    1.SOAP endpoint programing provides optionset label text very easily but microsoft provide less document. very sad situation.
    2.optionset on a Form is more easy. Xrm.PageScript library can handle it. and it can call from silverlight programs.
    3.if you want to make a entity definition sheet or metadatabrowser like tool. only these purpose, look metadata.

    me the last comer of this field but no old thing and get new info.
    anyway your blog was my start point.
    thank you.

  3. Xitij Thool

    Is is possible to get all the Attribute metadata instead of specifying the attributes individually.

  4. //For all attribute metadata.

    foreach (var _attr in ((EntityMetadata)response.Results[0].Value).Attributes)
    {
    if (((Label)_attr.DisplayName).UserLocalizedLabel != null)
    {
    AttributeInfo _artinfo = new AttributeInfo();
    _artinfo.LogicalName = _attr.LogicalName;
    _artinfo.DisplayName = ((Label)_attr.DisplayName).UserLocalizedLabel.Label;
    _artinfo.Type = _attr.AttributeType.ToString();
    lstAttributeInfo.Add(_artinfo);
    }
    }

  5. Bob

    “CRM 2011 + Retrieve Metadata in Silverlight Web Resource using Organization Service.
    | Sayantan Samanta” Window Treatments actually got me
    personally simply addicted with your webpage! Iwill wind up being back a lot more
    frequently. Thanks -Alta

  6. Pingback: Retrieving the Text of an OptionSet in Silverlight - Thinking Different | Thinking Different

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s