How to Get List of Changes in a Shelveset Programmatically?

In a previous post, we used the command-line to list the changes in a shelveset. This time we are going to use an API to get the changes by calling:

VersionControlServer.QueryShelvedChanges

You have to be a valid user that can connect to Version Control, and you don't need a workspace to call this method. The method returns an array of PendingSets, and a PendingSet has a member called PendingChanges which is an array of pending changes.