[This is preliminary documentation and is subject to change.]

Inserts data into OfficeClip based on a service type. This call is valid for the following service types.
Entity(Id)Description
Tracker Issue(4)The OfficeClip Tracker Issue. Note that the binder Sid must be supplied for each row in order to insert the issue in a binder.
Task(8)The OfficeClip Task. The Service subtype for this type is the Contact(18) and Account(31)
Event(14)The OfficeClip Calendar Events. The Service subtype for this type is the Contact(18) and Account(31)
Contact(18)The contact management metaentity
Note(20)The OfficeClip Notes Entity. The Service subtype for this type is the Contact(18) and Account(31)
Attachment(24)Document attachments with various applications
Mail Merge Campaign(28)The mail merge campaign information
Timesheet(34)Timesheet information. Note that the endDate of the period will automatically be calculated. It will return an error if the startDate is not within a range of valid startDate for the timesheet.
Timesheet Detail(35)Timesheet Detail information
Expense(36)Expense information
Expense Detail(37)Expense Detail information. The service subtype for this type is Expense (36)

Namespace:OfficeClip.Service.Web
Assembly: �OfficeClip.Service (in OfficeClip.Service)
Version: 8.1.1.0

Syntax

C#
public DataSet Insert(
	int serviceType,
	DataSet ds
)
Visual Basic (Declaration)
Public Function Insert ( _
	serviceType As Integer, _
	ds As DataSet _
) As DataSet
Visual C++
public:
DataSet^ Insert(
	int serviceType, 
	DataSet^ ds
)

Parameters

serviceType
Type: System..::.Int32
An integer that represents the service type for which the schema is desired.
ds
Type: System.Data..::.DataSet
The dataset containing the data to be inserted. The data is available in the first table of the dataset.

Return Value

The output dataset. The schema of the dataset is the schema for the service type "Return Value".

Examples

CopyInserts a campaign attachment
/// <summary>
///  Inserts a campaign. The campaign is previously saved as c:\temp\test.doc
///  This will insert the campaign document in OfficeClip via the web service.
/// A mailmerge campaign will be stored in OfficeClip as attachemtn
/// </summary>
/// <param name="ofg">Reference to the web service proxy</param>
public static void InsertCampaignAttachment(
 WebServiceClient.Generic.OfficeClipGeneric ofg,
 string sid
 )
{
 DataSet ds = null;
 try
 {
    // Retrieve the schema for service type 24 (attachments)
    StringReader sr = new StringReader(ofg.GetXmlSchema(24));
    ds = new DataSet();
    ds.ReadXmlSchema(sr);
    sr.Close();
    // This schema will be used to create a dataset to insert value
    // in OfficeClip.
    ds.Tables.Add(new DataTable());
    DataTable dt = ds.Tables[0];
    DataRow dr = dt.NewRow();
    dr["sid"] = "1";
    dr["fileName"] = "test.doc";
    dr["documentKey"] = "";
    dr["documentDescription"] = "";
    dr["applicationId"] = 27; // The application id 27 is the application id of the campaign
    dr["applicationSecondaryId"] = 1; // secondary id of 1 denotes attachment for mailmerge campaigns
    dr["id"] = sid;
    dr["isZipped"] = false; 
    // Open the campaign from the local drive for reading
    FileStream fs = new FileStream(
     @"c:\temp\test.doc",
     FileMode.Open,
     FileAccess.Read
    );
    // Read the file as a set of bytes so it can be serialized by the webservices interface
    // and sent. The webservice will reconstruct the file at the server.
    BinaryReader br = new BinaryReader(fs);
    dr["bytes"] = br.ReadBytes((int)br.BaseStream.Length);
    dt.Rows.Add(dr);
    // Send the file as attachment
    DataSet dsResult = ofg.Insert(24, ds);
    // The schema of the returning dataset can be extracted using the GetSchema call
    // with service type 25 (Return value). For this example we know that there are
    // two columns called sid (unique service id) and errorDescription.
    Console.WriteLine("Serial Id: " + (string)dsResult.Tables[0].Rows[0]["sid"]);
    Console.WriteLine("Error: " + (string)dsResult.Tables[0].Rows[0]["errorDescription"]);
 }
 catch (SoapException ex)
 {
    Console.WriteLine(ex.Message);
 }
}

See Also