Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Creating ShortCuts (Delphi 7)
Duprat
Hello,
What i´m trying to do is add a shortcut to a document that is in a different database of a WorkSpace.
I have created a collection of Documents containing the document that is on the other database. Then i get a Folder of the WorkSpace that i want, get the Folder´s content and use the method AddNewContentShortcut to add the shortcut of the document.
Here is the the code:
vIManSession : IManSession;
vDocument : IManDocument;
vDocuments : IManDocuments;
vShortCuts : IManContentShortcuts;
vShortCutoriginal, vShortCut : IManContentShortcut;
vFolder : IManFolder;
vDataBaseNames : IManStrings;
Content : IManContent;
Contents : IManContents;
.
.
.
...vIManSession.SearchDocuments(vDataBaseNames,vSe archParameters, true, Contents); //here i could get the document that is on the other database
...if assigned(Contents) then
...begin
....Contents.Get_Count(ndocs);
....for x:=1 to ndocs do
....begin
......//add the reference of the doc that is on the same database as the WorkSpace (This is working just fine)
......Contents.ItemByIndex(x,IManContent(vDocument ));
......vFolder.Get_Contents(IManContents(vDocuments ));
......vDocuments.AddDocumentReference(vDocument,Co ntent);
......if not assigned(Content) then
......begin
........//Add the ShortCut of the doc of the other database
........Contents.ItemByIndex(x, IManContent(vShortCutOriginal));
........vFolder.Get_Contents(IManContents(vShortCu ts));
........vShortCuts.AddNewContentShortcut(IManDocum ent(vShortCutOriginal), vShortCut);
......end;
....end;
...end;
But vShortCut is returning me 'nil' and does not assign the shortcut.
Do you guys have any clue how i can deal with that?
Regards,
Duprat
Find more posts tagged with
Comments
jny
It looks like, from your code snippet, you're add the content shortcut to the AddNewContentShortcut Method when you should be adding the document object itself.
I was able to use the VB script below to add a document shortcut from one database to another:
Dim oDMS As New ManDMS
Dim oSess As IManSession
Dim ofldr As IManDocumentFolder
Dim oShortcuts As IManContentShortcuts
Dim oShortcut As IManContentShortcut
Dim oDoc As IManDocument
Set oSess = oDMS.Sessions.Add("NTDEVSUPPORT")
oSess.TrustedLogin
Set ofldr = oDMS.GetObjectBySID("!nrtdms:0:!session:NTDEVSUPPORT:!database
SS1:!folder
rdinary,30:")
Set oDoc = oSess.Databases.ItemByName("DSS2").GetDocument(103, 1)
' Cast folder document collection to shortcuts collection
Set oShortcuts = ofldr.Contents
Set oShortcut = oShortcuts.AddNewContentShortcut(oDoc)
MsgBox oShortcut.ObjectID & " is added as a shortcut to folder, " & ofldr.Name
ofldr.Update
Duprat
It worked just fine in VB. But when i convert the same code to Delphi it doesn´t work.
I created a DLL to do the job but i have to use it in delphi.
Do you guys know how to call a DLL, created through VB, from Delphi?
Do i have to put something on the DLL´s code to tell that it will be used in other programs?
Like "EXTERNAL", used on Delphi.
Thanks
Duprat
Guys,
Need no futher help on this issue anymore.
I just found out how to call the VB DLL.
Thank you.
Carlos