Click or drag to resize
WebCrmApiSaveDocument Method
Registers or updates a webCRM document.

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 SaveDocumentDataResult SaveDocument(
	WebCrmDocumentData document,
	byte[] file
)

Parameters

document
Type: dk.webCRM.ApiSync.BusinessLayer.EntitiesWebCrmDocumentData
Document data.
file
Type: SystemByte
Document file. The argument cannot be empty when registering new document, but it is optional when updating an existing one. Maximal size of the file is 30MB.

Return Value

Type: SaveDocumentDataResult
Returns error status and ID number of the processed document.
Examples
// Login and get a webservice ticket
WebCrmApiSoapClient proxy = new WebCrmApiSoapClient();
ErrorStatus errorStatus;
TicketHeader ticket = proxy.Authenticate("cm1111aaaaaa", "username", "password", out errorStatus);

// Prepare document file
string fileName = "D:\\SKODA_Yeti_17062013.doc";
byte[] file = File.ReadAllBytes(fileName);

// Prepare document data
WebCrmDocumentData document = new WebCrmDocumentData() {
    Description = "Skoda Yeti",
    Folder = "Auto",
    UserGroup = 0,
    Territory = 0,
    LanguageCode = 0,
    UserId = 0,
    OrganisationId = 1234,
    LinkedEntityType = 2,
    LinkedEntityId = 23,
    FileName = "yeti.doc"
};

// Save the document
SaveDocumentDataResult result = proxy.SaveDocument(ticket, document, file);
See Also