Search code examples
tridiontridion-2011tridion-content-deliveryugc

UGC user is coming back as Null


I'm using the UGC web service to return UGC content but I have an issue in that users are being returned as null. The users are being entered into the UGC database - I can see users in both the UGC_USERS table and the UGC_ITEMS tables but when it comes to retrieving the comments using the odata.svc the user is coming back as null.

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

Does anyone know why this would be the case? Audience Manager isn't plumbed in at this point. We're simply adding comments from a domain user - the username is appearing in the UGC database but the user is coming back as null when we retrieve the comments from odata.

Thanks

John


Solution

  • John,

    Make sure you're using the Expand method in your calls:

    client.Comments.Expand("User")
    

    This will ensure the full User data is also part of the results.

    You can see it clearly if you query Odata directly:

    odata.svc/Comments?$expand=User
    

    Cheers