The GetTask method is used to fetch the interface on a Task object for the specified project, if it exists. This method bypasses a complete loading of the Project object when fetching this interface.
VBScript Syntax
IManager.GetTask ProjectName
Parameters
ProjectName
A string (VT_BSTR) specifying the name of a project to fetch the task object for.
Return Value
If defined, the ITask dispinterface specified by a Project object's Task property. Null (VT_NULL) is returned otherwise.
Remarks
An exception will occur if the project specified does not exist.
The project name can be an absolute pathname, a relative pathname, or just a name, in which case the default path "c:\microsoft site server\data\pushcfg" is assumed. You can skip appending the ".ppr" extension, as it is assumed in all cases.
Example
' Using Windows Scripting Host and VBScript
Option Explicit
Dim Manager
Dim Items
Dim Task
On Error Resume Next
Set Manager = CreateObject("Push.Manager")
Set Task = Manager.GetTask "projname"
If Err.Number <> 0 Then
WScript.echo "no project by that name"
ElseIf vartype(Task) = vbNull Then
WScript.Echo "No Task object for that project"
Else
' (do something with the task object)
' (code ommited)
End If
See Also