Sunday, April 1, 2012

Overriding context of SocialComments Control/WebPart


I have to override the current context of social comment control, in detail i need to have the control point to a different url from the current url. After exploring and digging through reflector i see a property Uri(internal) for SocialComment control but im not sure if there is a direct way of setting this. Using Reflection is worth a try.
I explored a little more and luckily found the property, WebPartPropertySpecifiedAddress for the webpart but not the control.

this.socialCommentsWebPart.WebPartPropertySpecifiedAddress = urlToCommentOn;
Above line of code need to be written OnInit.