Esempio n. 1
0
        public PBIGroups RESTGetGroupsAdmin()
        {
            string    adminGroupsContent = RESTWrapper("admin/groups");
            PBIGroups adminGroups        = JsonConvert.DeserializeObject <PBIGroups>(adminGroupsContent);

            return(adminGroups);
        }
Esempio n. 2
0
        public PBIGroup RESTGetGroupByName(string groupName)
        {
            string    responseContent = RESTWrapper(String.Format("groups?$filter=name eq '{0}'", groupName));
            PBIGroups pbiGroups       = JsonConvert.DeserializeObject <PBIGroups>(responseContent);

            return(pbiGroups.List[0]);
        }
Esempio n. 3
0
        public PBIGroups RESTGetGroups()
        {
            string    responseContent = RESTWrapper("groups");
            PBIGroups pbiGroups       = JsonConvert.DeserializeObject <PBIGroups>(responseContent);

            return(pbiGroups);
        }
Esempio n. 4
0
        public void RESTListReports()
        {
            PBIGroups groups = RESTGetGroups();

            foreach (PBIGroup group in groups.List)
            {
                Console.WriteLine(group.name);

                PBIReports reports = RESTGetReports(group.id);

                foreach (PBIReport report in reports.List)
                {
                    Console.WriteLine("     " + report.name);
                }
            }
        }
Esempio n. 5
0
        public void RESTDumpReportRefreshesToCsv()
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(String.Format(@".\Refreshes_{0}.csv", DateTime.Now.ToString("yyyyMMddhhmmss")));
            sw.WriteLine("Workspace;DataSet;RefreshType;StartTime;EndTime;Status");

            Dictionary <PBIGroup, PBIDataSets> groupDatasets = new Dictionary <PBIGroup, PBIDataSets>();

            string groupName = null, datasetName = null;
            int    datasetCount = 0, groupCount = 0;

            try
            {
                groupName = "";
                PBIGroups groups = RESTGetGroups();

                foreach (PBIGroup group in groups.List)
                {
                    groupCount++;
                    groupName    = group.name;
                    datasetCount = 0;
                    datasetName  = "";

                    try
                    {
                        PBIDataSets datasets = RESTGetDatasets(group.id);
                        Console.WriteLine(String.Format("Group: {0} ({1} / {2})", group.name, groupCount, groups.List.Count));

                        foreach (PBIDataSet dataset in datasets.List)
                        {
                            try
                            {
                                datasetCount++;
                                datasetName = dataset.name;
                                PBIRefreshes refreshes = RESTGetRefreshes(group.id, dataset.id);

                                Console.WriteLine(String.Format("     Dataset: {0} ({1} / {2}) - {3} refreshes", dataset.name, datasetCount, datasets.List.Count, refreshes.List.Count));

                                foreach (PBIRefresh refresh in refreshes.List)
                                {
                                    datasetName = dataset.name;

                                    sw.WriteLine(String.Join(";", new String[] {
                                        group.name,
                                        dataset.name,
                                        refresh.refreshType,
                                        refresh.startTime.ToString("yyyy.MM.dd hh:mm:ss"),
                                        refresh.endTime.ToString("yyyy.MM.dd hh:mm:ss"),
                                        refresh.status
                                    }));
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("     Query error (group: " + groupName + ", dataset: " + datasetName + ")");
                                sw.WriteLine(groupName + ";" + datasetName + ";;;;");
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Query error (group: " + groupName + ")");
                        sw.WriteLine(groupName + ";;;;;");
                    }
                }
            }
            catch
            {
                Console.WriteLine("Query error");
            }

            sw.Close();
        }