/// <summary> /// Set document property /// </summary> /// <param name="propertyName">property name</param> /// <param name="propertyValue">property value</param> public Boolean SetProperty(string propertyName, string propertyValue) { try { string strURI = Product.BaseProductUri + "/words/" + FileName + "/documentProperties/" + propertyName; string signedURI = Utils.Sign(strURI); //serialize the JSON request content DocumentProperty docProperty = new DocumentProperty(); docProperty.Value = propertyValue; string strJSON = JsonConvert.SerializeObject(docProperty); Stream responseStream = Utils.ProcessCommand(signedURI, "PUT", strJSON); StreamReader reader = new StreamReader(responseStream); string strResponse = reader.ReadToEnd(); //Parse the json string to JObject JObject pJSON = JObject.Parse(strResponse); DocumentResponse baseResponse = JsonConvert.DeserializeObject <DocumentResponse>(pJSON.ToString()); if (baseResponse.Code == "200" && baseResponse.Status == "OK") { return(true); } else { return(false); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Set document property /// </summary> /// <param name="propertyName">property name</param> /// <param name="propertyValue">property value</param> public Boolean SetProperty(string propertyName, string propertyValue) { try { string strURI = Product.BaseProductUri + "/words/" + FileName + "/documentProperties/" + propertyName; string signedURI = Utils.Sign(strURI); //serialize the JSON request content DocumentProperty docProperty = new DocumentProperty(); docProperty.Value = propertyValue; string strJSON = JsonConvert.SerializeObject(docProperty); Stream responseStream = Utils.ProcessCommand(signedURI, "PUT", strJSON); StreamReader reader = new StreamReader(responseStream); string strResponse = reader.ReadToEnd(); //Parse the json string to JObject JObject pJSON = JObject.Parse(strResponse); DocumentResponse baseResponse = JsonConvert.DeserializeObject<DocumentResponse>(pJSON.ToString()); if (baseResponse.Code == "200" && baseResponse.Status == "OK") return true; else return false; } catch (Exception ex) { throw new Exception(ex.Message); } }