コード例 #1
0
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The Dfa user object running the code example.
    /// </param>
    public override void Run(DfaUser user) {
      // Create SpotlightRemoteService instance.
      SpotlightRemoteService service = (SpotlightRemoteService) user.GetService(
          DfaService.v1_20.SpotlightRemoteService);

      long activityGroupId = long.Parse(_T("INSERT_ACTIVITY_GROUP_ID_HERE"));
      long activityTypeId = long.Parse(_T("INSERT_ACTIVITY_TYPE_ID_HERE"));
      long tagMethodTypeId = long.Parse(_T("INSERT_TAG_METHOD_TYPE_ID_HERE"));
      long countryId = long.Parse(_T("INSERT_COUNTRY_ID_HERE"));
      string url = _T("INSERT_EXPECTED_URL_HERE");
      string activityName = _T("INSERT_ACTIVITY_NAME_HERE");

      // Set spotlight activity structure.
      SpotlightActivity spotActivity = new SpotlightActivity();
      spotActivity.id = 0;
      spotActivity.activityGroupId = activityGroupId;
      spotActivity.activityTypeId = activityTypeId;
      spotActivity.tagMethodTypeId = tagMethodTypeId;
      spotActivity.name = activityName;
      spotActivity.expectedUrl = url;
      spotActivity.countryId = countryId;

      try {
        // Create the spotlight tag activity.
        SpotlightActivitySaveResult result =  service.saveSpotlightActivity(spotActivity);

        // Display new spotlight activity id.
        if (result != null) {
          Console.WriteLine("Spotlight activity with id \"{0}\" was created.", result.id);
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to create spotlight activity. Exception says \"{0}\"",
            ex.Message);
      }
    }
コード例 #2
0
 public SpotlightActivitySaveResult saveSpotlightActivity(SpotlightActivity spotlightActivity) {
   object[] results = this.Invoke("saveSpotlightActivity", new object[] {spotlightActivity});
   return ((SpotlightActivitySaveResult) (results[0]));
 }