Homepage / Doc / List Surveys and Folders

List Surveys and Folders

The ListSurveysAndFolders method can be utilized to pull a full list of the top level, and sub level surveys and folders depending on inputs provided. This method will pull any surveys and folders that are accessible from the user that the AuthToken corresponds to.

This method is the same used to populate the survey and folder list on the survey dashboard.

class Program
    {
        static void Main(string[] args)
        {
            var authClient = new AuthService.AuthenticationServiceClient();
            var survClient = new SurveyService.SurveyManagementServiceClient();

            var authToken = string.Empty; //Generate auth token here

            var surveyFolderList = survClient.ListSurveysAndFolders(authToken, 1, 0, 100, null, false).ResultData;

            foreach (var i in surveyFolderList)
            {
                Console.WriteLine(i.Name);
                if (i.ChildrenCount != 0)
                {
                    var surveyList = survClient.ListSurveysAndFolders(authToken, i.ID, 0, 100, null, false).ResultData;
                    foreach (var t in surveyList)
                        Console.WriteLine($"--{t.Name}");
                }
            }
        }
    }

The sample code above will pull all surveys and folders at the root level, and display all surveys within their folders. This will result in something like this:

FolderName
–SurveyInFolder
–SurveyInFolder
Folder2Name
–SurveyInFolder
SurveyOutOfFolder

Input Parameters

Parameter Type Description
authToken string Authentication token to validate permission over the data requested
parentItemId int 0 will pull all Surveys 1 will pull all surveys and folders
pageNumber int 0 will pull all records any other int will pull that specific pages results
pageSize int Size of each page that Checkbox is to break the results into
filter string Value to filter the survey / folder list on. The filter here will always filter based on name.
includeSurveyResponseCount bool true will return the response count, false will not include the response count in the results
May 12, 2017