Hi people, I have a question to make.
I am trying to complete the whole process for documents on the OKM Repository (create, check-out and check-in) from another application I have running on a server (Microsoft CRM)
I have completed the creation process, and thought I finished the checkout + document update + checkin cycle back again on the okm repository. But when I published the code on the server I realized that the download process was not going to work because obviously the server is unable to create content on the client side.
Honestly I have no idea about how to download content directly from the OKM and into the client, is there any example that might help? Here is the code I have for the checkout-checkin process. I know the checkin process will work when solving this issue, but in the meantime I am hands-tied. I know I have to use some other actions like documentService.setContent and documentService.checkin
I am trying to complete the whole process for documents on the OKM Repository (create, check-out and check-in) from another application I have running on a server (Microsoft CRM)
I have completed the creation process, and thought I finished the checkout + document update + checkin cycle back again on the okm repository. But when I published the code on the server I realized that the download process was not going to work because obviously the server is unable to create content on the client side.
Honestly I have no idea about how to download content directly from the OKM and into the client, is there any example that might help? Here is the code I have for the checkout-checkin process. I know the checkin process will work when solving this issue, but in the meantime I am hands-tied. I know I have to use some other actions like documentService.setContent and documentService.checkin
Code: Select all
Thanks a lot for your help. private void checkoutDocumentFromOpenKm(String username, String password)
{
try
{
// OpenKM authentication
token = authService.login(username, password);
//Gets the content from the file and builds a new one locally, then does the checkout so nobody can edit it.
//documentService.cancelCheckout(token, "/okm:root/Proposals System/Base Components/test.txt");
byte[] localFile = documentService.getContent(token, okmPath, false);
writeByteArrayToFile(localFile, Constants.LOCAL_FILE_LOCALIZATION + okmFileName + okmFileExtension);
documentService.checkout(token, okmPath);
// Logout OpenKM
logOutOpenKm(token);
lblUploadStatus.Text = Constants.SUCCESS_MESSAGE_DOWNLOAD + okmFileName + okmFileExtension;
}
catch (Exception ex)
{
logOutOpenKm(token);
lblUploadStatus.Text = Constants.ERROR_MESSAGE_DOWNLOAD + ex.ToString();
}
}
//Checkin
private void checkinDocumentToOpenKm(String username, String password)
{
try
{
//string localFilePath = Server.MapPath(Constants.LOCAL_TEMPORAL_FOLDER) + FileUpload.FileName;
//string localFilePath = FileUpload1.Attributes["Value"];
FileUpload1.PostedFile.SaveAs(Constants.LOCAL_TEMPORAL_FOLDER);
// OpenKM authentication
token = authService.login(username, password);
// Upload a document to OKM
byte[] localFile = readFile(Constants.LOCAL_TEMPORAL_FOLDER);
documentService.setContent(token, okmPath, localFile);
documentService.checkin(token, okmPath, "");
// Logout OpenKM
logOutOpenKm(token);
lblUploadStatus.Text = Constants.SUCCESS_MESSAGE_UPLOAD;
// Deleting the temp file
//File.Delete(Constants.LOCAL_TEMPORAL_FOLDER);
}
catch (Exception ex)
{
logOutOpenKm(token);
lblUploadStatus.Text = Constants.ERROR_MESSAGE_UPLOAD + ex.ToString();
}
}