This article demonstrates how to use the 'QueryEmailsByTicketNumbers' and 'QueryEmailsByFolders' SOAP API functions and also provides a C# code sample to demonstrate implementation.
To use SOAP to query emails in FocalScope by ticket number, do the following:
Please note: Parameter values for the 'QueryEmailsByTicketNumbers' and 'QueryEmailsByFolders' functions must match the above examples precisely. Also, the security token is mandatory and must not have expired.
Figure 1 - ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
namespace ConsoleSoapClient
{
class Program
{
static SoapService.SoapApi soapService;
static void QueryEmailsByTicketNumbers(string secToken, string fileName)
{
string[] rgTicket = {"1589","10079","7185","8513","17218","1543" };
string fOnlyTicketRoot = "true";
DataSet ds = new DataSet();
ds = soapService.QueryEmailsByTicketNumbers(secToken, rgTicket, fOnlyTicketRoot);
XmlTextWriter writer = new XmlTextWriter(fileName, null);
writer.Formatting = Formatting.Indented;
ds.WriteXml(writer);
}
static void QueryEmailsByFolders(string secToken, string fileName)
{
string[] rgFolder = { "Shared Items/Ticketboxes/2.4 Other PCR" };
string fOnlyTicketRoot = "0";
string DateFrom = "2013-12-01";
string DateTo = "2013-12-20";
string DataLimit = "100";
string PageNo = "3";
DataSet ds = new DataSet();
ds = soapService.QueryEmailsByFolders(secToken, rgFolder, fOnlyTicketRoot, DateFrom, DateTo, DataLimit, PageNo);
XmlTextWriter writer = new XmlTextWriter(fileName, null);
writer.Formatting = Formatting.Indented;
ds.WriteXml(writer);
}
static void Main(string[] args)
{
soapService = new SoapService.SoapApi();
soapService.Url = "http://localhost/emm/net/soapapi.asmx";
string secToken = "6710ebc2da8754782f1e14ab8b6c7be5";
QueryEmailsByTicketNumbers(secToken, "EmailsByTickets.xml");
QueryEmailsByFolders(secToken, "EmailsByFolders.xml");
}
}
}
0 Comments