Partial Class SetEmailPreference
Inherits System.Web.UI.Page
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
GetAllSyndicationServices()
End Sub
Public Sub GetAllSyndicationServices()
' Sets the email preference for the publisher account. Set to 'true' if the publisher
' like to receive promotion emails. You must have a web reference added to the
' URL "https://sandbox.google.com/api/adsense/v2/AccountService?wsdl" and
' name the webreference as "AdSenseAccounts"
Dim accountService As New AdSenseAccounts.AccountServiceService()
' Set the headers before you call the service method.
' Set the developer account email
accountService.developer_emailValue = New AdSenseAccounts.developer_email()
accountService.developer_emailValue.Text = New String() {"developer7@google.com"}
' Set the develoepr account password
accountService.developer_passwordValue = New AdSenseAccounts.developer_password()
accountService.developer_passwordValue.Text = New String() {"devpass"}
' Set the client Id.
accountService.client_idValue = New AdSenseAccounts.client_id()
accountService.client_idValue.Text = New String() {txtClientID.Text}
Try
accountService.setEmailPromotionsPreference(chkEmails.Checked)
Response.Write("<BR>Successfully set.")
Catch ex As System.Web.Services.Protocols.SoapException
Response.Write("<font color=red><B>" & ex.Message & "</B></font>")
End Try
End Sub
End Class