Take ID's for all reports

Hello,

I want to build a script to take all ID’s of my reports from my project and I am a little bit lost on the developer resources site… I was able to take only the id of the current view but I can’t iterate all reports/dashboards.

Thank you!

The way I’ve done this, you need to start with the project or folder id, right click and look in properties.

var topId = "xxxxx";

Then get the children of that id. You may need to take into account that these children may have children too.

dundas.context.getService("FileSystemService").getEntryById(topId,
 dundas.filesystem.GetEntryOptions.INCLUDE_CHILDREN).done(
function(e){ 
e.allChildren.....

//do something with all the children - maybe filter them to find those that are dundas.entities.ViewType.REPORT and then iterate over them

});

If you have a whole tree, you need to recursively iterate through to get the bottom level of each branch, and then perform the action you want on those.

Something like

	getChildren = function (topId)
    {
    	dundas.context.getService("FileSystemService").getEntryById(topId,
 dundas.filesystem.GetEntryOptions.INCLUDE_CHILDREN).done(function (f)
    	{
    		f.allChildren.forEach(function (e)
    		{
    			if (e.objectType.includes("Folder"))
				{
    				getChildren(e.id);
				}
				else
				{
				   doStuff(e);
				}
    		}
    		);    
    	})
	}

Hope that starts you off