SpreadWebServcie.UploadContactListFile Method

上传联系人数据文件.

参数

参数

类型

描述

loginEmail

String

Spread账号的登录邮箱.

loginPassword

String

Spread账号的登录密码或者API Key.

fileType

String

上传数据文件类型包括".xls", ".csv", ".xlsx".

myFileStream

byte()

上传数据文件流(小于100M). 上传文件模板

ContactListName

String

联系人名单的名称.

返回结果

String or Exception. 如果上传成功,返回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.

状态/场景

返回类型

返回信息

成功上传联系人文件,且进行处理。

String

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

请求API时使用错误的账号或者API Key;
请求API时使用一个不存在的联系人名单名称。
Exception

返回异常含错误信息'Contact List "SubscriptionName" does not exist!'.

上传错误类型的文件,比如 *.jpg, *.doc 或者其它类型的文件。 Exception

返回异常含错误信息'File extensions is not allowed. (Extensions Allowed: .csv|.xls|.xlsx)'.

其他错误情况。 Exception

返回异常含错误信息 'Upload failed. ' 和其它关于错误的内容。

例子

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");

^