Facepunch.Steamworks Wiki

Listing Workshop Items

At some point you'll probably want to grab a list of workshop items to show to your players. This could be anything from addons, maps, screenshots, saved games, demo files etc. Valve don't specify what they upload - you do.

Queries

I've tried to make things easy and hopefully as a c# user it'll seem familar.

The following queries screenshots that have been created by your friends.

var q = Ugc.Query.Screenshots.CreatedByFriends();

This is the same except they're sorted by creation date

var q = Ugc.Query.Screenshots .CreatedByFriends() .SortByCreationDate();

This is the same except tagged "funny"

var q = Ugc.Query.Screenshots .CreatedByFriends() .WithTag( "funny" ) .SortByCreationDate();

Item Types

The types correspond to the enum EUGCMatchingUGCType. Valve does a good job of explaining the categories there.

So you can search all items with ak47 in the title/description like:

var q = Ugc.Query.Items .WhereSearchText( "ak47" ) .RankedByTextSearch();

Conditional

The query doesn't have to be created on one line

var q = Ugc.Query.Items .WithTag( "funny" ); if ( order ) q = q.SortByCreationDate(); else q = q.SortByCreationDateAsc()

Pages

Results are returned in pages. And the page number starts at 1.

var page = await q.GetPageAsync( 1 ); if ( items?.ResultCount == 0 ) { Log( $"This page has {page.Value.ResultCount}" ); foreach ( Ugc.Item entry in page.Value.Entries ) { Log( $"Entry: {entry.Title}" ); } }