Exemplo n.º 1
0
        // Get Document list using CMSquery.. Only applicable for 4.2 and above
        public SAPDocumentList GetDocumentList(string FolderId)
        {
            SAPDocumentList docList;
            string          send = string.Empty;
            string          recv = string.Empty;

            send = "<attrs xmlns=\"http://www.sap.com/rws/bip\">" +
                   "<attr name = \"query\" type = \"string\">" +
                   "SELECT TOP 50000 SI_NAME, SI_ID, SI_KIND, SI_UPDATE_TS,  SI_UNIVERSE, SI_DSL_UNIVERSE, " +
                   "SI_FHSQL_RELATIONAL_CONNECTION, SI_PARENTID, SI_FILES, SI_PARENT_FOLDER " +
                   "from CI_INFOOBJECTS, CI_SYSTEMOBJECTS, CI_APPOBJECTS WHERE si_kind = 'Webi' " +
                   "AND SI_INSTANCE = 0 AND SI_ANCESTOR = " + FolderId +
                   "</attr ></attrs>";

            try
            {
                webAPIconnect.Send("POST", "/biprws/v1/cmsquery?pagesize=2000", send, "application/xml", "application/JSON");
                recv = webAPIconnect.responseContent;

                docList = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <SAPDocumentList>(recv);
                Debug.WriteLine(docList.entries.Count.ToString());
                Debug.Flush();
                foreach (SAPDocument item in docList.entries)
                {
                    item.SI_PATH          = GetDocumentPath(FolderId, item.SI_ID);
                    item.DataProviderList = GetDocumentDataproviders(item);
                    item.ParameterList    = GetDocumentParameters(item.SI_ID);
                    item.ReportList       = GetDocumentReports(item.SI_ID);
                }

                return(docList);
            }
            catch (Exception e)
            {
                Debug.WriteLine(recv);
                Debug.WriteLine(e.Message);
                Debug.Flush();
                return(null);
            }
        }