Client Support
Showing results for 
Search instead for 
Do you mean 

HPRM 8.1 WebService - Cannot download document as checkedout

Advisor

HPRM 8.1 WebService - Cannot download document as checkedout

Hi Everyone,

 

I am doing  research on how to download a document as checkedout using HPRM 8.1 WebService.

 

However, when I try to download the document using WebService API, it always download as supercopy even I have Checkout set to true. Below is my testing code:

 

public void downloadDoc(bool markAsCheckOut)

{

   // some initial variables

   string fileLoc = @"C:\temp\mydocument.doc";

   bool finished = false;

   int DownloadChunkSize = 10000;

  

   Engine engine = new Engine();

   engine.Credentials = new System.Net.NetworkCredential("Syd\\Tester", "Pass");

   RecordStringSearchClause stringClause = new RecordStringSearchClause();

   stringClause.Type = RecordStringSearchClauseType.RecordNumber;

   stringClause.Arg = "D14-1";

   RecordSearch recSearch = new RecordSearch();

   recSearch.Items = new RecordClause[] { stringClause };

 

   Download down = new Download();

   down.Checkout = true; //mark as checked out

   down.TransferType = TransferTypeType.mtom;

   down.MaximumTransferBytes = DownloadChunkSize;

 

   TrimRequest request = new TrimRequest();

   request.Items = new Operation[] { recSearch, down };

 

   using (FileStream fs = File.OpenWrite(fileLoc))

   {

     while (!finished)

     {

       TrimResponse resp = engine.Execute(request);

       foreach (Result chunkRes in resp.Items)

       {

          switch (chunkRes.GetType().Name.ToString())

          {

             case "ErrorResult":

                   ErrorResult err1 = (ErrorResult)chunkRes;

                   Console.WriteLine(err1.Message);

                   message = err1.Message;

             return;

             case "DownloadResult":

                   DownloadResult dnres = (DownloadResult)chunkRes;

                   finished = dnres.FinalChunk;

                   fs.Write(dnres.MTOMPayload, 0, dnres.MTOMPayload.Length);


                   down.TransferInset = down.TransferInset + DownloadChunkSize;

                   down.DownloadId = dnres.DownloadId;

                   message = "DownloadResult";

             break;

          }

       }

    }

    fs.Close();

 }

}

 

My development environment is:

 

1) HPRM 8.1x64

2) IIS 7.5 with WSE3 installed

3) HPRM Webserviex64  installed

4) visual Studio 2013 professsional

5) DB is on SQL server 2008R2

 

 

Anybody has the similar problem when they download document using WebService?

 

Does anybody have any information about solving this problem. Any information will be appreciated.

 

Thanks

 

 

Brian

 

 

2 REPLIES
Honored Contributor

Re: HPRM 8.1 WebService - Cannot download document as checkedout

Initial questions:

 

  • Can the user actually edit records?  Check that you're not connecting in as a guest account (meaning authenticatoin is working correctly).
  • Has the document been finalized?  This would prevent editing.
Advisor

Re: HPRM 8.1 WebService - Cannot download document as checkedout

Hi,

 

Yes, the document is editable. I have tried to check out the document using Web Client, Record Manager thick client, they both work as expected which the record marked as Checked out.

 

At this stage, what I observed is that only the WebService does't download as check out properly, instead, download as supercopy no matter Checkout property is set or not. In addition, it seems to me that the following fields are not passed to HPRM when I assigned values to them:

 

1) Checked out?

2) Checked out To

3) Checked out Path

4) Checked out On

 

I am not sure what are missed in my code. The code was descirbed on the RM8.1_WebService.pdf.

 

Regards

 

Brian

 

 

//Add this to "OnDomLoad" event