Click or drag to resize
WebCrmApiWriteCollectionToWebcrm Method
Updates or creates collection of entities.

WriteCollectionToWebcrm is deprecated, please use WriteCollectionToWebcrmDirect instead.

Namespace: dk.webCRM.ApiSync.WebService
Assembly: dk.webCRM.ApiSync.WebService (in dk.webCRM.ApiSync.WebService.dll) Version: 2.0.0.5 (2.0.0.5)
Syntax
public WriteCollectionToWebCrmResult WriteCollectionToWebcrm(
	DataEntityType entityType,
	WebCrmDataCollection collection
)

Parameters

entityType
Type: dk.webCRM.ApiSync.BusinessLayer.EnumsDataEntityType
Entity type.
collection
Type: dk.webCRM.ApiSync.BusinessLayer.EntitiesWebCrmDataCollection
Collection of WebCrmData objects specifying entities to update or add. Entities are identified by specific fields corresponding to entity type. For example, for person it is Person_ID. If the identifier is equal to 0 then new entity is to be added with the given data. Note that entity identifier is required here. Otherwise entity will not be processed.

Return Value

Type: WriteCollectionToWebCrmResult
Returns IDs of the processed entities as well error status for each separate item and for the whole collection.
Examples
// Login and get a webservice ticket
WebCrmApiSoapClient proxy = new WebCrmApiSoapClient();
ErrorStatus errorStatus;
TicketHeader ticket = proxy.Authenticate("cm1111aaaaaa", "username", "password", out errorStatus);

// Write to webCrm
WebCrmData productData1 = new WebCrmData
{
    Pairs = new KeyValuePair[] {
        new KeyValuePair("4_System_ID", "0"),
        new KeyValuePair("4_prd_organisationID", "1"),
        new KeyValuePair("4_Year", "1998") }
};
WebCrmData productData2 = new WebCrmData
{
    Pairs = new KeyValuePair[] {
        new KeyValuePair("4_System_ID", "0"),
        new KeyValuePair("4_prd_organisationID", "1"),
        new KeyValuePair("4_Year", "1999") }
};
WebCrmDataCollection productCollection = new WebCrmDataCollection()
{
    DataRecords = new WebCrmData[] { productData1, productData2 }
};
WriteCollectionToWebCrmResult result = 
    proxy.WriteCollectionToWebcrm(ticket, DataEntityType.Products, productCollection);
See Also