Adds a task to the list of tasks in a shared workspace. Returns a SharedWorkspaceTask object.
Note Beginning with Microsoft Office 2010, this object or member has been deprecated and should not be used.
expression. Add( ** Title, ** Status, ** Priority, ** Assignee, ** Description, ** Due Date )
expression Required. A variable that represents a SharedWorkspaceTasks object.
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Title | Required | String | The title of the new task. |
Status | Optional | msoSharedWorkspaceTask | The status of the new task. Default is msoSharedWorkspaceTaskNotStarted. |
Priority | Optional | msoSharedWorkspaceTask | The priority of the new task. Default is msoSharedWorkspaceTaskNormal. |
Assignee | Optional | SharedWorkspaceMember | The member to whom the new task is assigned. |
Description | Optional | String | The description of the new task. |
DueDate | Optional | Date | The due date of the new task. |
The schema that defines shared workspace tasks and their properties for a SharePoint site can be modified on the server in such a way that the Add method of the SharedWorkspaceTasks collection may raise an error, or may disregard the values of certain arguments. In particular, the task status and priority enumerations can be customized. Some examples of the problems that can result are mentioned below:
-
If a Status argument is supplied, and the status field has been removed from the customized tasks schema, the argument will be ignored and no error will be raised.
-
If a Status value is supplied that lies outside the status values recognized by the customized tasks schema, the argument will be ignored, the default value will be used, and no error will be raised.
-
If a new required field has been added to the customized tasks schema, then the Add method will fail with an error, and it will no longer be possible to use the Add method to add new tasks.
The following example adds a new task to the tasks collection of the shared workspace, specifies a due date, and assigns the task to the first member of the shared workspace.
Dim swsTask As Office.SharedWorkspaceTask
Dim swsMember As Office.SharedWorkspaceMember
Set swsMember = ActiveWorkbook.SharedWorkspace.Members(1)
Set swsTask = ActiveWorkbook.SharedWorkspace.Tasks.Add( _
"Complete document by year-end", _
msoSharedWorkspaceTaskStatusNotStarted, _
msoSharedWorkspaceTaskPriorityNormal, _
swsMember, _
"My first shared workspace task", #12/31/2005#)
MsgBox "New task: " & swsTask.Title, _
vbInformation + vbOKOnly, _
"New Task in Shared Workspace"
Set swsMember = Nothing
Set swsTask = Nothing