Returning ItemStats from Tridion UGC
Asked Answered
F

1

6

I was wondering if anyone can offer any pointers on this one. I'm trying to return ItemStats from the Tridion UGC web service but I'm getting the following error when trying to bind the results:-

The closed type TridionWebUGC.CDS.ItemStat does not have a corresponding LastRatedDate settable property.

An example of code is:-

WebServiceClient ugcCall2 = new WebServiceClient();
    Uri uri = new Uri("http://new.ugc.service/odata.svc");
    CDS.ContentDeliveryService cds = new CDS.ContentDeliveryService(uri);

var myItemStats = cds.ItemStats.Where(p => p.PublicationId == 68 && p.Id == 17792 && p.Type==16);

I can get comments and ratings with no problem. E.g.

    var myComments = cds.Comments.Where(p => p.ItemId == 17805).OrderBy(p => p.CreationDate);

It's just ItemStats that are giving me an issue. Anybody any ideas?

Thanks

John

Floatplane answered 30/1, 2013 at 14:43 Comment(0)
S
8

Unfortunately, the metadata of the UGC WebService is not correct in regards to the ItemsStats. For you it means that the webservice metadata does not expose the fact that the ItemStat entity contains the LastRatedDate property. This makes your .NET proxies not to be aware of this property and makes your query fail. To work-around this defect you have two option:

  1. Add to your service the following property: cds.IgnoreMissingProperties = true;. Advantage of this approach is that you're done with it in 2 sec. Disadvantage is that you will not be able to access that property (in case you actually use it);
  2. Modify the proxies generated by Visual Studio and manually add that property to the ItemStat class. Advantage of this approach is that you will be able to access the property from your project. Disadvantage is that it's totally not manageable from the coding point of view, you need to be careful when you upgrade or regenerate the proxies and it's easy to make a mistake while manually adding the property.

Note 1: to access the metadata of your webServer from the browser your can go to /odata.svc/$metadata.

Note 2: on a closer look there are 2 properties missing from the webService metadata: LastRatedDate and LastCommentedDate.

Hope this helps.

Stinky answered 30/1, 2013 at 15:14 Comment(2)
Hey Daniel, has this defect been fixed in 2013?Simulant
Hi @Quirijn: Not yet. It has been scoped for 2013 but it's too early to say if it's gonna be included into the release.Stinky

© 2022 - 2024 — McMap. All rights reserved.