Remote enabling or disabling of tasks by non BPA Platform administrators can be achieved by using vb script triggered from a webpage, as shown in the example code below:
Host = BPA Platform Server Name/IP User = Username for user who has access 'Script Object Access' set in the users screen Password = This users password TaskId = xxx ' Set the task id you wish to enable/disable here. Set myAPI = CreateObject("Iwcltcp.TCAPI") Set mySession=myAPI.Logon (1,Host,User,Password) Set myTaskItem=mySession.OpenTaskItem(TaskId) myTaskItem.Disabled=true 'myTaskItem.Disabled=false
The Contents property on a Folder object provides access to the task objects within it.
This example enables all the tasks in the top level “Tasks” folder:
set myapi=CreateObject("iwcltcp.tcapi") set mysession=myapi.Logon (1,Host,User,Password) set myfolders=mysession.Folders set myContents=myfolders("Tasks").Contents for i=0 to myContents.Count -1 myContents(i).Disabled=false msgbox("I have just enabled " & myContents(i).Name) next
You can get the folders too. As well as Contents property which is a collection of tasks, the folder object has a ChildFolders property which contains all of its sub folders.
Using the example above, changing the line where myContents is set will enable all the tasks in “Tasks\FolderName”:
set myContents=myfolders("Tasks").ChildFolders("FolderName").Contents
The ChildFolders object is a collection like the Contents object, so you can loop through it and access individual folders by index too:
for i=0 to myfolders("Tasks").ChildFolders.Count -1 msgbox("sub folders " & myfolders("Tasks").ChildFolders(i).Name) next
This example will disable every task in the store:
for i=0 to thisFolder.ChildFolders.Count -1 DisableAllTasks(thisFolder.ChildFolders(i)) next set myContents=thisFolder.Contents for i=0 to myContents.Count -1 myContents(i).Disabled=true msgbox("I have just disabled " & myContents(i).Name & " in folder " & thisFolder.Name) next end function set myapi=CreateObject("iwcltcp.tcapi") set mysession=myapi.Logon (1,Host,User,Password) set myfolders=mysession.Folders
Please refer to the BPA Platform help files for details regarding the API object model.