[...] Are you trying to add rules to a folder so that the rules engine will kick in to fire e-mail notification when a certain event occurs on the specified folder? [...]
Hi!... which is what I am currently trying to achieve, but have not yet found any clue in the documentations about.My intuition tells me, if I wanted to add a rule to a folder in order to fire an e-mail when a document is filed into it, I would have to look in the properties of that folder. But the properties dialog does not have any option about rules, neither in FileSite nor in DeskSite. Does anybody know where I should look?Regards,Wolfgang
Dim pDms As New ManDMSDim pSess As IManSessionDim pDb As IManDatabaseDim pFolders As IManDocumentFoldersDim pFolder As IManDocumentFolderDim pRuleEventHandler As IManRuleHandlerDim pRule As IManRuleDim pEventtypes As IManRuleEventTypesDim pEventtype As IManRuleEventTypeDim sRuleActionData As String'this string is used to store the XML data which represents the rule action data. On Error GoTo OopsSet pSess = pDms.Sessions.Add("")pSess.TrustedLoginSet pDb = pSess.PreferredDatabase' Create a new folder to test ruleSet pFolders = pDb.Root.SubFoldersSet pFolder = pFolders.AddNewDocumentFolder("TestRuleFolder", "Folder created to add rules via the SDK")' Get rule handlerWith pDbIf Not .RuleHandlers Is Nothing ThenIf .RuleHandlers.Count > 0 ThenSet pRuleEventHandler = .RuleHandlers.Item(1) 'The RulesEngine supports only one, which is Email Notification.End IfElseGoTo CleanupEnd IfEnd With' Get event types. Currently, WorkSite Web supports the following event types for document folders:' Add Document to Folder (Import Document)' Remove Document (Delete Document)' Create Version in Folder (New Document Version)Set pEventtypes = pDb.RuleEventTypes' Add a rule to a folderSet pRule = pFolder.Rules.Add("Import Document", sRuleActionData, pRuleEventHandler, "", pRuleEventHandler.Name)' Add a rule event type to rulepRule.RuleEventTypes.Add pEventtypes.Item(8) ' Item 8 fires an event of Delete Document' Iterate through collection to find an event type suitable for you.pRule.Update' Get event typeSet pEventtype = pRule.RuleEventTypes.Item(1)' Log folder eventpFolder.LogEvent pEventtype, pRuleEventHandler.NamepFolder.UpdateGoTo CleanupOops:MsgBox Err.DescriptionErr.ClearResume NextCleanup:If pSess.Connected Then pSess.LogoutpDms.CloseSet pDms = NothingSet pSess = NothingSet pDb = NothingSet pFolders = NothingSet pFolder = NothingSet pRuleEventHandler = NothingSet pRule = NothingSet pEventtypes = NothingSet pEventtype = Nothing
Thank you, jny, this helps a huge step. I'm sure I'll come back with more detailed questions later, though. :-)(Scratching my head) One more question arises: How come the Rules Engine is installed along with WorkSite Server, when you actually need to have WorkSiteWeb to use it?