How to change status of a file

I tried to change status of files using this code but it doesn't work :

 

Try

Dim RevApp = New RevisionManager.Application()

Dim RevOpenDoc As RevisionManager.Document

RevOpenDoc = RevApp.Open(strFileName)

RevOpenDoc.Status = RevisionManager.DocumentStatus.igStatusAvailable

MsgBox("Status Changed")

Catch ex As Exception

End Try

 

Anyone can help me ?

 

Romuald

 

Posted by: Romuald
Post date: 9/26/2012 12:16:33 PM

4 REPLIES

How to change status of a file

I'm just guessing but I would imagine that they enforce the GUI rules in the API. i.e. You can't change a status from Released -> Available via the GUI. It can be done but you have to use low level Microsoft APIs to do it. http://msdn.microsoft.com/en-us/library/windows/desktop/aa380365.aspx]Structured Storage Reference

 

Posted by: Jason Newell
Post date: 9/26/2012 12:20:17 PM

How to change status of a file

I achieve to change status of my files without using revmanager APIs.

 

Just need to open it in SE and then change properties :

 

[i]objDoc.Properties("ExtendedSummaryInformation")("Status").Value = 0[/i]

 

I still have a problem with this solution when opening processed files in SolidEdge, a popup tell me that files are available but read-only.

I need to click on seek write access and save the file to get rid of this message.

 

Is there any way to change this prop without this message ?

 

Posted by: Romuald
Post date: 9/27/2012 5:30:23 AM

How to change status of a file

Did you call a save API?

 

Posted by: R.D. Holland
Post date: 9/27/2012 6:33:11 PM

How to change status of a file

I manage to do it with files properties API, thanks to Terry :

 

[i] Public Function SetStatusAvailable(ByRef File As String) As String

' function change status of Released, baselined or obselete documents.

 

Dim objPropertySets As SolidEdgeFileProperties.PropertySets = Nothing

Dim objProperties As SolidEdgeFileProperties.Properties = Nothing

Dim objProperty As SolidEdgeFileProperties.Property = Nothing

Dim OpenReadOnly As Object

 

SetStatusAvailable = ""

OpenReadOnly = "False"

objPropertySets = New SolidEdgeFileProperties.PropertySets

 

If Not (objPropertySets Is Nothing) Then

objPropertySets.Open(File)

objProperties = objPropertySets.Item("ExtendedSummaryInformation")

If Not objProperties Is Nothing Then objProperty = objProperties.Item("Status")

If Not objProperty Is Nothing Then objProperty.Value = 0

SetStatusAvailable = "AVAILABLE"

objPropertySets.Save()

End If

 

' now need to do .Net garbage collection to release all the objects so SE can open the file read-write.

If Not objProperty Is Nothing Then System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objProperty)

If Not objProperties Is Nothing Then System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objProperties)

If Not objPropertySets Is Nothing Then

objPropertySets.Close()

System.Runtime.InteropServices.Marshal.FinalReleaseComObject(objPropertySets)

End If

objPropertySets = Nothing

objProperties = Nothing

objProperty = Nothing

GarbageCollection()

 

End Function[/i]

 

I just need to test if it works with V20 files as well as ST2 and ST4 ones.

 

Romuald

 

Posted by: Romuald
Post date: 9/28/2012 2:26:53 AM