addAttachment
Some tooltip text!
• 1 minute to read
• 1 minute to read
Description
Adds an attachment to Service. This attachment can be used to attach to a message, faq entry, reply template, and so on. The binary data should be automatically base64 encoded by your client SOAP stack, but if not you have to do this manually.
In parameters
| Parameter | Description |
|---|---|
| sessionKey | A valid session key |
| attachmentName | File name of the attachment |
| contentType | The content type, for example, "application/octet-stream", "image/gif" |
| data | binary data |
Out parameters
| Parameter | Description |
|---|---|
| errorCode | See list of codes |
| attachmentId | The ID of the newly inserted attachment |
Example
ticket.ticketService ticketService = new ticket.ticketService();
string sessionKey;
string errorCode = ticketService.login("egon", "norges bank", out sessionKey);
if (errorCode.Equals("0"))
{
System.IO.FileStream infile = new System.IO.FileStream("DivFix.exe", System.IO.FileMode.Open,System.IO.FileAccess.Read);
byte[] buffer = new byte[infile.Length];
int read = infile.Read(buffer,0,(int)infile.Length);
infile.Close();
string attachmentId;
ticketService.addAttachment(sessionKey, infile.Name, "application/octet-stream", buffer, out attachmentId);
}