is there any code example on how i can use .AddFileShared?
what i am trying to do is add a reference to another pdm/conisio folder, so it can be opened from there while the actual file is located somewhere else...isnt it what addFileShared does?
there is no code example in Programmer's reference guide 2009
here is my code from C#
folder = (
IEdmFolder5)vault.GetObject(EdmObjectType.EdmObject_Folder, folderID);
folder.AddFileShared(fileID, 0);
it doen't do anything, no reference or anything is added to the folder
EdmLib v5.13.0.0
Hi Max,
Your code looks correct. Have you verified:
1. That the file ID is valid?
2. That it isn't enough to do a manual refresh in the Windows Explorer afterwards (i.e. the link is actually created).
You can also try out the code below, which works for me. It lets you browse for a file and a destination folder, shares the file and makes sure the destination folder is refreshed in the Explorer.
Cheers,
/Erik
Private
Sub ShareAFile(ByVal vault As IEdmVault5)
On
Error GoTo ErrHand
'Browse for the source file
Dim pathList As IEdmStrLst5
pathList = vault.BrowseForFile(
Me.Handle, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select File to Share")
If pathList Is Nothing Then Exit Sub
Dim path As String
path = pathList.GetNext(pathList.GetHeadPosition())
Dim file As IEdmFile5
file = vault.GetFileFromPath(path)
'Browse for the destination folder
Dim folder As IEdmFolder5
folder = vault.BrowseForFolder(
Me.Handle.ToInt32, "Select Destination Folder")
If folder Is Nothing Then Exit Sub
'Share the file
folder.AddFileShared(file.ID,
Me.Handle.ToInt32)
'Make sure the result shows in open Explorer windows
vault.RefreshFolder(folder.LocalPath)
Exit Sub
ErrHand:
Dim errnam As String
Dim errdesc As String
vault.GetErrorString(Err.Number, errnam, errdesc)
MsgBox(
"Could not share file." + vbLf + errdesc)
End
Sub