/// <summary> /// Updates the value of a document property with the new property value. /// /// Gets the property type id for the specified property type name. /// Gets the document contract for the specified document id. The contract /// contains an array of property contracts. Gets a list of property contracts. /// The method searches for the property contract with the property type id. /// If it finds the contract, it updates the property contract with the new /// value. Then it updates the document contract's properties field. /// Afterwards it calls the updateDocument method on an instance of the /// InfoShareService class and passes the connection id, the document contract, /// and the check in parameter contract as arguments. /// Releases the reservation of the document in order that other users can edit the document /// Returns a document contract, if the document is successfully updated. /// /// </summary> /// <param name="documentClient">the document client of the info share WCF service</param> /// <param name="commonClient">the common client of the info share WCF service</param> /// <param name="connectionID">the connection id</param> /// <param name="documentID">the document id</param> /// <param name="propertyTypeName">the property type name</param> /// <param name="newPropertyValue">the new property value</param> /// <param name="schemaCulture">the schema culture</param> /// <returns>the document contract</returns> public DocumentContract UpdateDocumentProperty(CommonService commonService, string connectionID, string documentID, string propertyTypeName, string newPropertyValue, string schemaCulture) { string propertyTypeID = commonService.GetPropertyTypeID(propertyTypeName, schemaCulture); DocumentContract documentContract = this.DocumentClient.GetDocument(connectionID, documentID); // Loops through all properties of property contract foreach (PropertyContract propertyContract in documentContract.Properties) { if (propertyContract.PropertyTypeId == propertyTypeID) { // If property contract found, set new value propertyContract.Values = new string[] { newPropertyValue }; break; } } CheckInParameterContract checkInParameterContract = new CheckInParameterContract { // Releases the reservation of the document in order that other users can edit the document ReleaseReservation = true }; documentContract = this.DocumentClient.UpdateDocument(connectionID, documentContract, null, checkInParameterContract); return(documentContract); }
/// <summary> /// Updates the document with a new file version. /// </summary> /// <param name="connectionID">the connection id</param> /// <param name="documentContract">the document contract to be updated</param> /// <param name="fileId">the file id of the new file version</param> /// <returns>the updated document contract</returns> public DocumentContract UpdateDocument(string connectionID, DocumentContract documentContract, string fileId = null) { CheckInParameterContract checkInParameterContract = new CheckInParameterContract { // Releases the reservation of the document in order that other users can edit the document ReleaseReservation = true, Comment = "Updated trough FIVE-Docreminder." }; DocumentContract updatedDocumentContract = this.DocumentClient.UpdateDocument(connectionID, documentContract, fileId, checkInParameterContract); return(updatedDocumentContract); }