Dave,
I can get a list of all campaigns, however I would like to limit it to the most current, maybe the current month or last 90 days since that really all we can work with any way. I'm having an issue with the way the datetime is returned 2009-09-30T00:15:13.157Z. Not sure How I would filter on this in a dataview.
Any suggestions?
'setup httpWebReqeust to send the request
Dim address As New Uri(sUri)
Dim theRequest As HttpWebRequest = TryCast(WebRequest.Create(address), HttpWebRequest)
theRequest.Credentials = New NetworkCredential((sAPIKey & "%" & ctu), ctp)
theRequest.Method = "GET"
theRequest.ContentType = "application/vnd.ctct+xml"
Using theResponse As HttpWebResponse = TryCast(theRequest.GetResponse(), HttpWebResponse)
'load dataset with xml response
Dim xtr As New XmlTextReader(theResponse.GetResponseStream())
xtr.ReadString()
Dim dsct As New DataSet()
dsct.ReadXml(xtr)
Dim dataView As DataView = dsct.Tables("Campaign").DefaultView
dataView.RowFilter = "Date >= '" & DateTime.Today.Year.ToString() & "-" & DateTime.Today.AddMonths(-1).Month.ToString() & "-1' AND Date <='" & DateTime.Today.Year.ToString() & "-" & DateTime.Today.Month.ToString() & "-1'" ddCampaigns.DataSource = DataView
ddCampaigns.DataTextField = "Name"
ddCampaigns.DataValueField = "id"
ddCampaigns.DataBind()
ddCampaigns.Items.Insert(0, "")
End Using
ALSO
I'm trying to return an xml file that includes the stats for a selected campaign. I can use this to return the service document, but I'm not sure what to do next in order to return the stats for the selected campaign (email).
Dim sUri As String = "https://api.constantcontact.com/ws/customers/" & ctu & "/campaigns/" & strCampaignID & "/events/"
Dim sAPIKey As String = ""
'setup httpWebReqeust to send the request
Dim address As New Uri(sUri)
Dim theRequest As HttpWebRequest = TryCast(WebRequest.Create(address), HttpWebRequest)
theRequest.Credentials = New NetworkCredential((sAPIKey & "%" & ctu), ctp)
theRequest.Method = "GET"
theRequest.ContentType = "application/vnd.ctct+xml"
Using theResponse As HttpWebResponse = TryCast(theRequest.GetResponse(), HttpWebResponse)
'load dataset with xml response
Dim xtr As New XmlTextReader(theResponse.GetResponseStream())
xtr.ReadString()
Dim dscte As New DataSet()
dscte.ReadXml(xtr) ', XmlReadMode.IgnoreSchema
Dim dataView As DataView = dscte.Tables("Campaign").DefaultView
'dataView.RowFilter = ''
'Create the xml file to check what we are receiving.
dscte.WriteXml("C:\Data.xml")
End Using
... View more