Panopto API 101: Getting folders

Return to the Panopto API index page

In this example we’re going to get a list of our folders. If you’re on a new server this is quite easy, but with a long list you may crash Visual Studio.

Double click on app.config in the Solutions Explorer

Double click app.config to open it up

Now adjust all the maxBufferSize, maxBufferPoolSize, and maxReceivedMessageSize values to 2097152. They are in multiple locations as we have added multiple service references.

We’re increasing the amount of data to expect back from the server

Hopefully now we can receive a decent amount of data back from the server, however the program will still crash if it receives multiple hundreds of folders back. We’ll deal with this by bringing back 5 at a time. We do this with pagination.

Under // START WRITING CODE HERE from the starting code on page 100 write

Here we’re making a new pagination object and telling it that we want 5 results at a time and to start from the beginning (page 0).

Did you notice that we’re using the PanoptoSessionManagement namespace? If we’re using that namespace, and we need to authenticate, we need to use PanoptoSessionManagement.AuthenticationInfo

Paste the following code in the // PUT YOUR AUTHENTICATION DETAILS HERE section

Next we’ll ask for our folders

First we made an object (sessionMgr) that we can use to call GetFoldersList, then called the command and put it into an object (ListFoldersReponse) made to contain folders.

If you were to debug this command now, you’d see we have an array of folders. They are filtered and sorted due to the text under ListFoldersRequest.

Pagination = … this is the pagination object mentioned above. It’s set to 5 results starting from the beginning (page 0)
ParentFolderID = … this is will only search for subfolders of a folder with this ID. We’ve told it to only search for parent folders by searching for Guid.Empty
SortIncreasing = true … this returns results from A-Z

(there are more options, but these are the ones I’m using)

Visual Studio can now see the results, but we aren’t outputting them. Paste this command in and C# will loop through the results and show 5 folders, if they exist

Run the program and you should see your folders

The first 5 folders on Panopto, sorted by name

Full program code below

Return to the Panopto API index page

Leave a Reply

Your email address will not be published. Required fields are marked *