Hello Payaa,
I see that you've entered a support ticket for this issue as well, but I'll answer it here so the answer is available to other developer kit users.
To get a list of surveys in a folder, you will want to use the GetAvailableTemplatesAndFolders(...) method of the ResponseTemplateManager.
Here is the method prototype...
The DataSet that is returned contains one table with columns that match the columns in the ckbx_TemplatesAndFolders view in the database. Rows for surveys have an ItemType field equal to 'Form' and rows for folder have an ItemType field equal to 'Folder'. In both cases, the ID of the form/folder is stored in the ItemID field and the name of the form/folder is stored in the ItemName field.Code:public static DataSet GetAvailableTemplatesAndFolders(FormFolder folder, int pagesize, int page, string filterField, string filterText, string sortField, bool descending, params string[] permissions)
Code:using Checkbox.Users; using Checkbox.Forms; //Step 1: Response templates are secured, so a valid user context must be established //Initialize UserManager, only needs to done once per application lifetime UserManager.Initialize(); //Login a user with permission to Edit or Take surveys if(UserManager.AuthenticateUser([USERNAME], [PASSWORD]) == null) { throw new Exception("User not authenticated!"); } int folderId = [ID OF FOLDER]; //First, get the folder (4.5 API method will accept folderId) FormFolder folder = new FormFolder(); folder.Load(folderId); //Now load the folders DataSet ds = ResponseTemplateManager.GetAvailableTemplatesAndFolders( folder, //folder to search in -1, //number of results per "page of results". Pass -1 for no paging of results -1, //"page" of results to get. Pass -1 for no paging null, //DB field to filter results on. Pass null for no filtering null, //Value of filter. Pas null for no filtering "ItemName", //DB field to use for sorting results, pass null for no filtering false, //Sort order. Pass true for descending order "Form.Edit", "Form.Fill") //Permissions to check for currently logged-in user //Get the rows for surveys DataRow[] surveyRows = ds.Tables[0].Select("ItemType = 'Form'");
...answers when you need them





LinkBack URL
About LinkBacks
Reply With Quote



