Exception | Description |
---|---|
System.ArgumentNullException | Thrown when the activity was supplied as a null reference (or Nothing in Visual Basic .NET). An Activity must be non-null in order for it's properties to be inserted into the data store. |
System.NotSupportedException | Thrown when the concrete type of activity is something other than Appointment. Presently, only the insertion of Appointment objects into the data store is supported. |
System.ComponentModel.WarningException | Thrown when the WebScheduleInfo property has not been properly initialized before calling AddActivity. In order for AddActivity to add the supplied activity to the data store, the WebScheduleDataProviderBase must already be initialized with the same WebScheduleInfo as the activity was. |
WebSchedule automatically handles adding an Activity when an end user submits a new Appointment through the user interface. Developers would call AddActivity to add additional Activities they may have created programmatically. Ordinarily, Activity instances added to the ActivitiesCollection on WebScheduleInfo are not automatically saved to the data store.
The AddActivity method also supports administrative and batch applications to transform external scheduling information into the WebSchedule data model, and bulk load it into the data store. An example is an application that extracts, transforms, and loads user schedules from Microsoft Exchange into WebSchedule.
Any setting of the DataKey or Key properties of the supplied activity will be ignored, since this method adds a new row to the Activity data table. When this method is successful, the DataKey on the supplied Activity object reference will be modified to contain the auto-generated identifier from the database.
The supplied resource is used to enter a new row into the ActivityResource child table. When specified, the resource must exist in the ResourcesCollection of WebScheduleInfo and within the data store, or the referential integrity constraint of the WebSchedule data model will be violated. The DataKey of the resource is used when adding this row to ActivityResource and must be valid for the operation to be successful.
Were the resource omitted (passed in as null or Nothing in Visual Basic .NET) then the activity will be associated with the UnassignedResource by default.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2