This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Checkin related problems continued...

Triadian - Wednesday, September 8, 2010 4:52 AM:

Hi,

 I have created a doucment and attached a file to it .Later I checked out that file (Document File) manually to a folder, and tried to check in the same file through program. I used attachPhysicalfile() function.After this there  is no increment in the version number of the file and also
 in the context menu of the document file, options for checkingout for file,directory  etc., are gone and lock status is corrupted.

If I manually check in the file every thing works fine. I couldn't figure whats wrong with my code, which works without any errors
 
The inputs to the program are file name (FileName) and directory(Dir), using which I am getting the
File item and trying to apply check in functionality on it

My code is as follows:

     Item search_itm = innovatorObj.newItem("File", "get");
            search_itm.setAttribute("select", "filename,checkedout_path");
            search_itm.setProperty("filename", FileName);
            search_itm.setProperty("checkedout_path", Dir);

            Item result_item = search_itm.apply();
           
                if (result_item.isError())
                {
                    MessageBox.Show(result_item.getErrorString());
                    return;
                }

                for (int i = 0; i < result_item.getItemCount(); i++) 
                {
                    Item FileItem = result_item.getItemByIndex(i);
                   
                    string FilePath = FileItem.getProperty("checkedout_path") + "\" + FileItem.getProperty("filename");
                       
                       
                     FileItem.attachPhysicalFile(FilePath);
     
                     Item Checkedin_item = FileItem.apply();

   if (Checkedin_item.isError())
   {
       MessageBox.Show(Checkedin_item.getErrorString());
       continue;
   }
   else
   {
       MessageBox.Show(FilePath + " checked in successfully");
   }

                                      
           }
                
                
            
               
       Regards,
       Shafi
               
           



Yoann Maingon - Wednesday, September 8, 2010 5:42 AM:

Well, i don't see any action from your AML there's just a get at the top. But we should see an Add action somewhere.

I would suggest a trip to Boston !! :-)

 

good luck



Triadian - Wednesday, September 8, 2010 6:58 AM:

Hi,

I am trying to retrieve  an existing file and checkin after making modifications, so I think I can used edit or update action instead of add.If I use add a new file is getting created which I donot want . 

Using the code I posted , 'checkedout_ path' value before my action had the directory value where the file was checked out  and after the apply() action it is empty, which means that item has been checked-in.Am I wrong?

 

 



Triadian - Thursday, September 16, 2010 2:55 AM:

Hi,

sorry for troubling you with my confusion. The problem is rectified now

Thanks