///<summary> ///Retrieving Workspace Information ///</summary> public void workspaceInfo(string workspace_resource) { HttpWebRequest request = WebRequest.Create(workspace_resource) 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")) { workspace ws = new workspace(); 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("//dsid")) { ws.dsid = citem.InnerText; } foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//iconId")) { ws.iconId = citem.InnerText; } foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//contents")) { ws.contents = citem.InnerText; } foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//timeCreated")) { ws.timeCreated = citem.InnerText; } foreach (XmlElement citem in wdoc.DocumentElement.SelectNodes("//collections")) { ws.collections = citem.InnerText; } workspacelist.Add(ws); } } }
///<summary> ///Updating Workspace Information ///</summary> public void updateworkspace(string workspace_resource, workspace ws) { HttpWebRequest request = WebRequest.Create(workspace_resource) as HttpWebRequest; request.Method = "PUT"; string xml_request = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" + "<workspace>" + "<displayName>" + ws.displayName + "</displayName>" + "<dsid>" + ws.dsid + "</dsid>" + "<timeCreated>" + ws.timeCreated + "</timeCreated>" + "<collections>" + ws.collections + "</collections>" + "<files>" + ws.contents + "?type=file" + "</files>" + "<contents>" + ws.contents + "</contents>" + "<iconId>" + ws.iconId + "</iconId>" + "</workspace>"; byte[] byteData = UTF8Encoding.UTF8.GetBytes(xml_request); request.ContentLength = byteData.Length; using (Stream postStream = request.GetRequestStream()) { postStream.Write(byteData, 0, byteData.Length); } using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { StreamReader reader = new StreamReader(response.GetResponseStream()); } }