Exemple #1
0
        ///<summary>
        ///Retrieving Albums Collection
        ///</summary>
        public List<workspaces> AlbumColl()
        {
            List<workspaces> lw = new List<workspaces>();
            HttpWebRequest request = WebRequest.Create(user + "/albums/contents") as HttpWebRequest;
            request.Method = "GET";
            request.Headers.Add("Authorization", accessToken);
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(reader.ReadToEnd());
                foreach (XmlElement xitem in doc.DocumentElement.SelectNodes("//collection"))
                {
                    workspaces ws = new workspaces();
                    XmlDocument wdoc = new XmlDocument();
                    wdoc.LoadXml("<root>" + xitem.InnerXml + "</root>");
                    foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//displayName"))
                    {
                        ws.displayName = citem.InnerText;
                    }
                    foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//contents"))
                    {
                        ws.contents = citem.InnerText;
                    }
                    foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//ref"))
                    {
                        ws.reference = citem.InnerText;
                    }
                    lw.Add(ws);
                }
            }
            return lw;
        }
Exemple #2
0
        ///<summary>
        ///Retrieving Workspace Contents
        ///</summary>
        public void workcontent(string workspace_resource)
        {
            HttpWebRequest request = WebRequest.Create(workspace_resource + "/contents") as HttpWebRequest;
            request.Method = "GET";
            request.Headers.Add("Authorization", accessToken);
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(reader.ReadToEnd());
                foreach (XmlElement xitem in doc.DocumentElement.SelectNodes("//collection"))
                {
                    workspaces ws = new workspaces();
                    XmlDocument wdoc = new XmlDocument();
                    wdoc.LoadXml("<root>" + xitem.InnerXml + "</root>");
                    foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//displayName"))
                    {
                        ws.displayName = citem.InnerText;
                    }
                    foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//ref"))
                    {
                        ws.reference = citem.InnerText;
                    }
                    foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//contents"))
                    {
                        ws.contents = citem.InnerText;
                    }
                    workspacescontent.Add(ws);
                }
            }
        }