SpreadWebServcie.UploadContactListFile Method

 

Upload contact list file

Parameters

Parameter

Type

Description

loginEmail

String

The login email of your Spread account.

loginPassword

String

The password of your Spread account or API Key which you can retrieve from your Spread account (My account=> Settings).

fileType

String

Type of upload data, include ".xls", ".csv", ".xlsx".

myFileStream

byte()

The upload file stream ( length<100MB ). Template File

ContactListName

String

The name of contact list.

Return Value

String or Exception. if Uploaded successfully,return String:Spread has received your data and will send you an email after upload complete. (RequestID:AAAABBBB-CCCC-DDDD-EEEE-FFFFGGGGHHHH)

Please find the details for the return message in the following table.

Status/Situation

Retrun Type

Retrun Message

Success

String

Spread has received your data and will send you an email after upload complete. (RequestID:AAAABBBB-CCCC-DDDD-EEEE-FFFFGGGGHHHH)

If you call API with error account or API Key.
If you call API with a not existed subscription.
Exception

Return a exception with message 'Contact List "SubscriptionName" does not exist!'.

If you upload a file with other type, e.g. *.jpg, *.doc or others. Exception

Return a exception with message 'File extensions is not allowed. (Extensions Allowed: .csv|.xls|.xlsx)'.

The other situations Exception

Return a exception with message 'Upload failed. ' and more information about error.

Example

string loginEmail = "Spread@reasonables.com";

string loginPassword = "Spread";

System.IO.FileStream fileStream = new System.IO.FileStream(@"D:\content1.xlsx", System.IO.FileMode.Open);

byte[] arrayByte = new byte[fileStream.Length];

fileStream.Read(arrayByte, 0, Convert.ToInt32(fileStream.Length));

fileStream.Close();

SpreadAPI.SpreadWebService MySpread = new SpreadAPI.SpreadWebService();

string result = MySpread.UploadContactListFile(loginEmail, loginPassword, ".xlsx", arrayByte, "test 20130204");

See Also

SpreadWebService Class | Spread Web Service Namespace