0

使用 Autonomy WorkSite 8.5 SP2 SDK,我试图以编程方式向其他用户添加快捷方式我被告知可以通过首先订阅其他用户我的事项,添加快捷方式然后取消订阅来完成。

因此,我尝试订阅其他用户的“我的事项”,但是我遇到了如何订阅的问题,使用以下代码我可以找到用户的“我的事项”:

Dim objSFSP As IManSubscriptionFolderSearchParameters = oDms.CreateSubscriptionFolderSearchParameters
objSFSP.Add( imFolderAttributeID.imFolderOwner, sShortcutUser )
Dim objFolders As IManFolders = oMatters.FindRootSubscriptionFoldersNotSubscribedTo(oDatabaseList, objSFSP)

通过阅读 COM 参考指南,我应该能够使用以下代码订阅用户 My Matters:

Dim objWorkArea As IManWorkArea = oSess.WorkArea
Dim oFolderShortcuts As IManSubscriptionFolderShortcuts = objWorkArea.SubscriptionFolder.SubFolders
Dim oFolderShortcut As IManFolderShortcut = oFolderShortcuts.AddNewSubscriptionFolderShortcutInheriting(objFolders)

我遇到的问题是需要返回对象AddNewSubscriptionFolderShortcutInheriting()类型的对象。IManSubScriptionFolderFindRootSubscriptionFoldersNotSubscribedTo()IManFolders

谁能指出我需要做什么才能将用户 My Matters 的实例作为 IManSubscriptionFolder 对象?

4

1 回答 1

2

可能我的回复对你来说有点晚了,但我希望它能帮助其他有同样问题的人。

回答您的问题,为了获取其他用户 My Matters 作为 IManSubscriptionFolder 对象的实例,您只需遍历 objFolders 集合并将每个文件夹转换为 IManSubScriptionFolder 类型。

请在下面找到我的工作解决方案:

ManDMS dms = new ManDMS();
string serverName = "dms.server.com";
IManSession session = dms.Sessions.Add(serverName);
string userID = "user";
string password = "password";
session.Login(userID, password);

ManStrings dblist = new ManStrings();
dblist.Add("TargetWsDbName");

IManSubscriptionFolderSearchParameters searchParams = ndms.CreateSubscriptionFolderSearchParameters();
string folderOwner = "AnotherUser";
searchParams.Add(imFolderAttributeID.imFolderOwner, folderOwner);
IManFolders nonSubscribedRootSubscriptionFolders = session.WorkArea.SubscriptionFolder.FindRootSubscriptionFoldersNotSubscribedTo(dblist, searchParams);

foreach (var folder in nonSubscribedRootSubscriptionFolders)
{
    //another user's subscription folder
    var subscriptionFolder = folder as IManSubscriptionFolder;
    if (subscriptionFolder != null)
    {
        //Current user's subscription folder shortcuts
        var subscriptionFolderShortcuts = session.WorkArea.SubscriptionFolder.SubFolders as IManSubscriptionFolderShortcuts;
        if (subscriptionFolderShortcuts != null)
        {
            subscriptionFolderShortcuts.AddNewSubscriptionFolderShortcutInheriting(subscriptionFolder);
        }
    }

请注意,上面的代码仅供参考,不是生产代码。

于 2015-05-22T21:46:42.037 回答