Error RevertReservedForWriteByMe in Apprenticeserver

Error RevertReservedForWriteByMe in Apprenticeserver

filat
Advisor Advisor
302 Views
5 Replies
Message 1 of 6

Error RevertReservedForWriteByMe in Apprenticeserver

filat
Advisor
Advisor

There is a multi-user project file. Another user has been granted permission to edit the file. I need to obtain permission to modify a file in Apprentice. Error 80004001 occurs in the code:

...
Dim invApprenticeDoc As ApprenticeServerDocument
invApprenticeDoc = oApprentServ.Open(oFilename)
If invApprenticeDoc.ReservedForWriteByMe = True Then
invApprenticeDoc.RevertReservedForWriteByMe ' there is an error here 80004001
end if
No error cycles are allowed! I need permission to change a file that I don't have rights to. How to do this using ApprenticeServer?
0 Likes
303 Views
5 Replies
Replies (5)
Message 2 of 6

filat
Advisor
Advisor

no comment?!??

0 Likes
Message 3 of 6

JelteDeJong
Mentor
Mentor

@filat wrote:

no comment?!??


I guess not.

 

I'm trying to understand what your code is supposed to do. In my experience, a file gets only locked if it is not checked out in the vault. The help description "Method that reverts the file checked out by the caller." for the method "ApprenticeServerDocument.RevertReservedForWriteByMe" Suggests also that you are trying to do something with a file locked by the vault. It seems bad practice to me to edit a file that is not checked out to you. But maybe I'm wrong and the file is locked for some other reason. But the situation sounds strange to me.

 

Anyway in my experience locked files have a Windows flag read-only. Removing that flag will unlock the file. Removing that flag can easily be done like this:

Dim fileInfo As New System.IO.FileInfo(oFilename)
fileInfo.IsReadOnly = False

Dim apprentice As New ApprenticeServerComponent
Dim invApprenticeDoc As ApprenticeServerDocument = apprentice.Open(oFilename)

 

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 4 of 6

filat
Advisor
Advisor

There is only a multi-user project on the local network.

vault - not used. vault - was not installed.

0 Likes
Message 5 of 6

filat
Advisor
Advisor

If I open a file in Inventor and call the RevertReservedForWriteByMe function, the result is: I get permission to edit the file.
I open a file in Apprentice (same file) and call the RevertReservedForWriteByMe function - result: error 80004001.

0 Likes
Message 6 of 6

filat
Advisor
Advisor

What's new?

0 Likes