wheribert - Wednesday, July 2, 2008 3:28 AM:
Hello,
I am searching for server-side methods that allow the download of a file to a local accessable drive without a checkout (similar to ... in the client gui) and for a method to change the filecontent with check-in and check out. Unfortunately I found only the following methods in the api doc:
- attachPhysicalFile (only client side)
- checkout (only client side)
I have got to realize a conversion of a cad-part after this has been checked in. The cad-part has two relations to documents - one for the cad-part itsself and one to the converted part. The converter is installed on the server and not on each client, therefore I need server side methods. I have a method that identifies all relevant objects and that is triggerd by the after update event. In this method I need to get a copy of the cad-part on a local accessable filesystem, start the conversion process and update the file that holds the converted part.
Currently I'm using Innovator Version 8.2.0 but a solution for the 9.0 would also be helpful.
Thanks in advance
M.Schüler
SamsAn - Wednesday, July 9, 2008 3:41 AM:
Hello.
Item.checkout method is supposed in 8.2.0 Server-Side methods too.
//+++++++++
Item files = myItem.getItemsByXPath( "/Item[@type='File']" );
int fcount = files.getItemCount();
for( int i = 0; i < fcount; i++ )
{
Item file = files.getItemByIndex( i );
Item result = file.checkout( "c:\temp" );
if( result.isError() )
{
Console.WriteLine( String.Format( "Failed to checkout file '{0}'", file.getProperty( "filename" ) ) );
}
}
return this.newInnovator().newResult("ok");
//--------------
wheribert - Thursday, July 10, 2008 3:47 AM:
Hello,
thanks for the code-block - I will give it a try.
Will this also work for checkin?
Is there a method that corresponds with the 'Get Copy Of "File" files' action in the gui?
Best regards
wheribert - Friday, July 11, 2008 4:25 AM:
Hello,
are you sure that the checkout method works on the server too? If I execute the following code
try {
Item result = myFile.checkout("c:\TEMP");
if (result.isError()){
Console.WriteLine( String.Format( "Failed to checkout file '{0}'", myFile.getProperty( "filename" )));
}
}
catch (System.Exception EX){
Console.WriteLine(EX.ToString());
}
with c:\TEMP existing and writable on the following Item
<Item type="File" typeId="8052A558B9084D41B9F11805E464F443" id="AE3883F594FC4D34ABB640E796C9292F" page="1" pagemax="1" itemmax="1">
<state>
Released
</state>
<current_state name="Released" keyed_name="Released" type="Life Cycle State">C363ABDADF8D485393BB89877DBDCFD0</current_state>
<config_id keyed_name="Teil1.SLDPRT" type="File">EF1B3F7E44DD4A6AA8B40DF3570C9CB8</config_id>
<mimetype>drawing/x-sld</mimetype>
<release_date>2008-07-11T08:06:12</release_date>
<checksum>E1FB4B3AB55811B21502D0515D6AD5B5</checksum>
<modified_on>2008-07-11T08:06:12</modified_on>
<not_lockable>0</not_lockable>
<major_rev>B</major_rev>
<created_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</created_by_id>
<modified_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</modified_by_id>
<is_current>1</is_current>
<id keyed_name="Teil1.SLDPRT" type="File">AE3883F594FC4D34ABB640E796C9292F</id>
<classification>/*</classification>
<created_on>2008-07-11T07:52:05</created_on>
<permission_id keyed_name="File" type="Permission">28D6DF9D51FA4B85A479D6D3341CE97B</permission_id>
<file_size>91648</file_size>
<checkedout_path></checkedout_path>
<new_version>0</new_version>
<file_type keyed_name="SOLIDWORKS" type="FileType">197CC5F7C4504F49A5C337314189DBEB</file_type>
<is_released>1</is_released>
<keyed_name>Teil1.SLDPRT</keyed_name>
<effective_date>2008-07-11T09:52:06</effective_date>
<generation>2</generation>
<filename>Teil1.SLDPRT</filename>
</Item>
I get the following output
Try to checkout file'Teil1.SLDPRT'
System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (404) Nicht gefunden.
bei System.Net.HttpWebRequest.GetResponse()
bei Aras.Utils.FileDownload.DownloadFile(Uri uri, String path)
bei Aras.IOM.Item.checkout(String dir)
bei PKG_C99A025178D01823A1ADC97CBD09B1E4.ItemMethod.methodCode() in c:ProgrammeArasInnovatorInnovatorServerdllr_zuvql.0.cs:Zeile 46.
The file item seems to represent an existing object but the checkout fails. Do you have any idea?
SamsAn - Thursday, July 10, 2008 3:59 AM:
Hello.
Try this method from Item class:
public void attachPhysicalFile( string filePath )
SamsAn - Friday, July 11, 2008 4:53 AM:
Hello.
I'm sure it works on the server too.
You error tells me the vault server file request returns http 404 error. It may be because of several reasons (file is stored in other vaultserver, so on). I recommend you to spy url requested by myFile.checkout() by a sniffer and analyze what is incorrect in the url.
wheribert - Thursday, July 10, 2008 4:56 AM:
Hello,
yes I found this method already and I will try is though it is documented only as serverside method.
But I did not find any method corresponding to the action 'Get Copy Of "File" files'. Where can I get the information about all existing methods - not only the documented ones - of the item class like a modern IDE will offer you whe you press the . after an item-variable?
SamsAn - Thursday, July 10, 2008 5:11 AM:
UI Checkout downloads the file from Vault server into working directory and marks File Item AML as checked out.
UI "Get Copy Of "File" files" do the same but don't marks File Item.
Item.checkout method downloads the file from Vault server into specified directory and marks File Item AML as checked out. Just do not apply modified File Item AML to "get copy".