Is there any sample code or code snippet that show me how to achieve that?
Please refer to the PI Application Development Training booklet in vCampus Training Center. It contains training and code snippets to deal with programming access to PI Notifications.
Also, you may want to consider attending our annual live event called vCampus Live! 2012 Nov. 28-30. There is a hands-on lab specifically on this topic where you can learn the latest tricks taught by OSIsoft developers and engineers.
I know hands - on lab will be beneficial. but that solution is more than two months away...
Retrieving data ...